From 217e5f6e4a9d1764bc511ca095bbb15a63bb3b19 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 3 Jan 2015 20:28:32 -0200 Subject: Improve the matches on the scaffold generator tests Related to #13434. --- railties/test/generators/scaffold_generator_test.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'railties/test/generators') diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index ad365f45d0..3b545328b5 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -63,20 +63,19 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase end # Views - %w(index edit new show _form).each do |view| - assert_file "app/views/product_lines/#{view}.html.erb" - end assert_no_file "app/views/layouts/product_lines.html.erb" - # Views local variables - assert_file "app/views/product_lines/_form.html.erb" do |test| - assert_no_match(/@product_line/, test) + %w(index show).each do |view| + assert_file "app/views/product_lines/#{view}.html.erb" end %w(edit new).each do |view| - assert_file "app/views/product_lines/#{view}.html.erb" do |test| - assert_match(/product_line: @product_line/, test) - end + assert_file "app/views/product_lines/#{view}.html.erb", /render 'form', product_line: @product_line/ + end + + assert_file "app/views/product_lines/_form.html.erb" do |test| + assert_match 'product_line', test + assert_no_match '@product_line', test end # Helpers -- cgit v1.2.3