Add some implicit path tests to Subscriber.

This commit is contained in:
José Valim 2010-01-15 17:55:08 +01:00
parent b2578a148c
commit 13d76b6170
1 changed files with 18 additions and 1 deletions

View File

@ -55,6 +55,15 @@ module ActionViewSubscriberTest
assert_match /Rendered test\/_customer.erb/, @logger.logged(:info).last
end
def test_render_partial_with_implicit_path
@view.stubs(:controller_path).returns("test")
@view.render(Customer.new("david"), :greeting => "hi")
wait
assert_equal 1, @logger.logged(:info).size
assert_match /Rendered customers\/_customer\.html\.erb/, @logger.logged(:info).last
end
def test_render_collection_template
@view.render(:partial => "test/customer", :collection => [ Customer.new("david"), Customer.new("mary") ])
wait
@ -63,6 +72,15 @@ module ActionViewSubscriberTest
assert_match /Rendered test\/_customer.erb/, @logger.logged(:info).last
end
def test_render_collection_with_implicit_path
@view.stubs(:controller_path).returns("test")
@view.render([ Customer.new("david"), Customer.new("mary") ], :greeting => "hi")
wait
assert_equal 1, @logger.logged(:info).size
assert_match /Rendered customers\/_customer\.html\.erb/, @logger.logged(:info).last
end
def test_render_collection_template_without_path
@view.stubs(:controller_path).returns("test")
@view.render([ GoodCustomer.new("david"), Customer.new("mary") ], :greeting => "hi")
@ -72,7 +90,6 @@ module ActionViewSubscriberTest
assert_match /Rendered collection/, @logger.logged(:info).last
end
class SyncSubscriberTest < ActiveSupport::TestCase
include Rails::Subscriber::SyncTestHelper
include ActionViewSubscriberTest