1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
Carlos Antonio da Silva 2012-08-25 21:50:20 -03:00
parent 6715343086
commit af31cf0672

View file

@ -81,8 +81,6 @@ class FormHelperTest < ActionView::TestCase
@post.tags = [] @post.tags = []
@post.tags << Tag.new @post.tags << Tag.new
@blog_post = Blog::Post.new("And his name will be forty and four.", 44)
@car = Car.new("#000FFF") @car = Car.new("#000FFF")
end end
@ -1168,7 +1166,9 @@ class FormHelperTest < ActionView::TestCase
end end
def test_form_for_with_model_using_relative_model_naming 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.text_field :title
concat f.submit('Edit post') concat f.submit('Edit post')
end end