Permalink
Browse files

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.
  • Loading branch information...
1 parent 6715343 commit af31cf067242757b2005197b10a2dfbe6bb89184 @carlosantoniodasilva carlosantoniodasilva committed Aug 26, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 actionpack/test/template/form_helper_test.rb
@@ -81,8 +81,6 @@ def @post.to_param; '123'; end
@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 @@ def test_form_for_with_format
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

0 comments on commit af31cf0

Please sign in to comment.