aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/test_case_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-03-12 16:00:01 +0000
committerPratik Naik <pratiknaik@gmail.com>2010-03-12 16:00:01 +0000
commite68bfaf1fe1a7890a67af6f444281185f507cf9e (patch)
tree5e73caccdcdd65d0ac97f9eb92195928f30925f2 /actionpack/test/template/test_case_test.rb
parentef6462c73003b28c8e060a06120abb9cd67b6d52 (diff)
parent16846553b8866eab2aa3b128a2a23a221a25f7e3 (diff)
downloadrails-e68bfaf1fe1a7890a67af6f444281185f507cf9e.tar.gz
rails-e68bfaf1fe1a7890a67af6f444281185f507cf9e.tar.bz2
rails-e68bfaf1fe1a7890a67af6f444281185f507cf9e.zip
Merge remote branch 'mainstream/master'
Conflicts: activerecord/lib/active_record/base.rb railties/lib/rails/configuration.rb railties/lib/rails/log_subscriber.rb
Diffstat (limited to 'actionpack/test/template/test_case_test.rb')
-rw-r--r--actionpack/test/template/test_case_test.rb35
1 files changed, 24 insertions, 11 deletions
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index be2c6b3108..195a6ea3ae 100644
--- a/actionpack/test/template/test_case_test.rb
+++ b/actionpack/test/template/test_case_test.rb
@@ -89,16 +89,23 @@ module ActionView
end
test "helper class that is being tested is always included in view instance" do
- self.class.helper_class.module_eval do
- def render_from_helper
- render :partial => 'customer', :collection => @customers
+ # This ensure is a hidious hack to deal with these tests bleeding
+ # methods between eachother
+ begin
+ self.class.helper_class.module_eval do
+ def render_from_helper
+ render :partial => 'customer', :collection => @customers
+ end
end
- end
- TestController.stubs(:controller_path).returns('test')
+ TestController.stubs(:controller_path).returns('test')
- @customers = [stub(:name => 'Eloy'), stub(:name => 'Manfred')]
- assert_match /Hello: EloyHello: Manfred/, render(:partial => 'test/from_helper')
+ @customers = [stub(:name => 'Eloy'), stub(:name => 'Manfred')]
+ assert_match /Hello: EloyHello: Manfred/, render(:partial => 'test/from_helper')
+
+ ensure
+ self.class.helper_class.send(:remove_method, :render_from_helper)
+ end
end
test "no additional helpers should shared across test cases" do
@@ -107,7 +114,7 @@ module ActionView
end
test "is able to use routes" do
- controller.request.assign_parameters('foo', 'index')
+ controller.request.assign_parameters(@router, 'foo', 'index')
assert_equal '/foo', url_for
assert_equal '/bar', url_for(:controller => 'bar')
end
@@ -147,10 +154,16 @@ module ActionView
end
test "is able to make methods available to the view" do
- _helpers.module_eval do
- def render_from_helper; from_test_case end
+ # This ensure is a hidious hack to deal with these tests bleeding
+ # methods between eachother
+ begin
+ _helpers.module_eval do
+ def render_from_helper; from_test_case end
+ end
+ assert_equal 'Word!', render(:partial => 'test/from_helper')
+ ensure
+ _helpers.send(:remove_method, :render_from_helper)
end
- assert_equal 'Word!', render(:partial => 'test/from_helper')
end
def from_test_case; 'Word!'; end