aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/test_case_test.rb
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-03-11 22:05:15 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-03-11 22:05:15 +1100
commitf5774e3e3f70a3acfa559b9ff889e9417fb71d4b (patch)
treee738112994d40d6c3792065da80bddfa7439467b /actionpack/test/template/test_case_test.rb
parentcefe723e285f20d1f2a33f67da03348568f7e0b0 (diff)
parent073852dff0b48296a9a184f94e722183334f3c4c (diff)
downloadrails-f5774e3e3f70a3acfa559b9ff889e9417fb71d4b.tar.gz
rails-f5774e3e3f70a3acfa559b9ff889e9417fb71d4b.tar.bz2
rails-f5774e3e3f70a3acfa559b9ff889e9417fb71d4b.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/test/template/test_case_test.rb')
-rw-r--r--actionpack/test/template/test_case_test.rb33
1 files changed, 23 insertions, 10 deletions
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index 12807baaa7..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
@@ -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