diff options
Diffstat (limited to 'railties/test/generators')
4 files changed, 28 insertions, 2 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 64579c1205..24e6d541c2 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -54,8 +54,8 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_application_controller_and_layout_files run_generator assert_file "app/controllers/application_controller.rb", /layout 'application'/ - assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag 'application'/ - assert_file "public/stylesheets/application.css" + assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag :all/ + assert_no_file "public/stylesheets/application.css" end def test_name_collision_raises_an_error diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index f5af137ced..8040b22fe6 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -66,6 +66,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase new show ).each { |view| assert_file "app/views/users/#{view}.html.erb" } + assert_no_file "app/views/layouts/users.html.erb" end def test_functional_tests diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 3cad65f503..e8e622fe5c 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -70,10 +70,14 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase show _form ).each { |view| assert_file "app/views/product_lines/#{view}.html.erb" } + assert_no_file "app/views/layouts/product_lines.html.erb" # Helpers assert_file "app/helpers/product_lines_helper.rb" assert_file "test/unit/helpers/product_lines_helper_test.rb" + + # Stylesheets + assert_file "public/stylesheets/scaffold.css" end def test_scaffold_on_revoke @@ -97,9 +101,13 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase # Views assert_no_file "app/views/product_lines" + assert_no_file "app/views/layouts/product_lines.html.erb" # Helpers assert_no_file "app/helpers/product_lines_helper.rb" assert_no_file "test/unit/helpers/product_lines_helper_test.rb" + + # Stylesheets (should not be removed) + assert_file "public/stylesheets/scaffold.css" end end diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb new file mode 100644 index 0000000000..aaeb686daa --- /dev/null +++ b/railties/test/generators/stylesheets_generator_test.rb @@ -0,0 +1,17 @@ +require 'generators/generators_test_helper' +require 'rails/generators/rails/stylesheets/stylesheets_generator' + +class StylesheetsGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper + + def test_copy_stylesheets + run_generator + assert_file "public/stylesheets/scaffold.css" + end + + def test_stylesheets_are_not_deleted_on_revoke + run_generator + run_generator [], :behavior => :revoke + assert_file "public/stylesheets/scaffold.css" + end +end |