44
55class ScaffoldControllerGeneratorTest < Rails ::Generators ::TestCase
66 tests Rails ::Generators ::ScaffoldControllerGenerator
7- arguments %w( Post title body:text images:attachments )
7+ arguments %w( Post title body:text images:attachments --skip-routes )
88 destination File . expand_path ( '../tmp' , __FILE__ )
99 setup :prepare_destination
1010
@@ -67,7 +67,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
6767 end
6868
6969 test 'controller with namespace' do
70- run_generator %w( Admin::Post --model-name=Post )
70+ run_generator %w( Admin::Post --model-name=Post --skip-routes )
7171 assert_file 'app/controllers/admin/posts_controller.rb' do |content |
7272 assert_instance_method :create , content do |m |
7373 assert_match %r{format\. html \{ redirect_to \[ :admin, @post\] , notice: "Post was successfully created\. " \} } , m
@@ -84,7 +84,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
8484 end
8585
8686 test "don't use require and permit if there are no attributes" do
87- run_generator %w( Post )
87+ run_generator %w( Post --skip-routes )
8888
8989 assert_file 'app/controllers/posts_controller.rb' do |content |
9090 assert_match %r{def post_params} , content
@@ -93,7 +93,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
9393 end
9494
9595 test 'handles virtual attributes' do
96- run_generator %w( Message content:rich_text video:attachment photos:attachments )
96+ run_generator %w( Message content:rich_text video:attachment photos:attachments --skip-routes )
9797
9898 assert_file 'app/controllers/messages_controller.rb' do |content |
9999 if Rails ::VERSION ::MAJOR >= 8
0 commit comments