diff options
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/fixtures/test/_partial_name_in_local_assigns.erb | 1 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/actionview/test/fixtures/test/_partial_name_in_local_assigns.erb b/actionview/test/fixtures/test/_partial_name_in_local_assigns.erb new file mode 100644 index 0000000000..28ee9f41c5 --- /dev/null +++ b/actionview/test/fixtures/test/_partial_name_in_local_assigns.erb @@ -0,0 +1 @@ +<%= local_assigns.has_key?(:partial_name_in_local_assigns) %>
\ No newline at end of file diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 22665b6844..27bbb9b6c1 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -277,6 +277,14 @@ module RenderTestCases assert_nil @view.render(:partial => "test/customer", :collection => nil) end + def test_render_partial_without_object_does_not_put_partial_name_to_local_assigns + assert_equal 'false', @view.render(partial: 'test/partial_name_in_local_assigns') + end + + def test_render_partial_with_nil_object_puts_partial_name_to_local_assigns + assert_equal 'true', @view.render(partial: 'test/partial_name_in_local_assigns', object: nil) + end + def test_render_partial_with_nil_values_in_collection assert_equal "Hello: davidHello: Anonymous", @view.render(:partial => "test/customer", :collection => [ Customer.new("david"), nil ]) end |