From af31cf067242757b2005197b10a2dfbe6bb89184 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 25 Aug 2012 21:50:20 -0300 Subject: [PATCH] Create variable only in the test that uses it Instead of building a Blog::Post instance for every test in form helper tests, just build it in the test that uses it. --- actionpack/test/template/form_helper_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 5c6cb45530..246c4bfada 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -81,8 +81,6 @@ class FormHelperTest < ActionView::TestCase @post.tags = [] @post.tags << Tag.new - @blog_post = Blog::Post.new("And his name will be forty and four.", 44) - @car = Car.new("#000FFF") end @@ -1168,7 +1166,9 @@ class FormHelperTest < ActionView::TestCase end def test_form_for_with_model_using_relative_model_naming - form_for(@blog_post) do |f| + blog_post = Blog::Post.new("And his name will be forty and four.", 44) + + form_for(blog_post) do |f| concat f.text_field :title concat f.submit('Edit post') end