4
4
5
5
class ScaffoldControllerGeneratorTest < Rails ::Generators ::TestCase
6
6
tests Rails ::Generators ::ScaffoldControllerGenerator
7
- arguments %w( Post title body:text images:attachments )
7
+ arguments %w( Post title body:text images:attachments --skip-routes )
8
8
destination File . expand_path ( '../tmp' , __FILE__ )
9
9
setup :prepare_destination
10
10
@@ -67,7 +67,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
67
67
end
68
68
69
69
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 )
71
71
assert_file 'app/controllers/admin/posts_controller.rb' do |content |
72
72
assert_instance_method :create , content do |m |
73
73
assert_match %r{format\. html \{ redirect_to \[ :admin, @post\] , notice: "Post was successfully created\. " \} } , m
@@ -84,7 +84,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
84
84
end
85
85
86
86
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 )
88
88
89
89
assert_file 'app/controllers/posts_controller.rb' do |content |
90
90
assert_match %r{def post_params} , content
@@ -93,7 +93,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
93
93
end
94
94
95
95
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 )
97
97
98
98
assert_file 'app/controllers/messages_controller.rb' do |content |
99
99
if Rails ::VERSION ::MAJOR >= 8
0 commit comments