Skip to content

Commit c4585e2

Browse files
committed
Add test for namespace request spec with --api option
1 parent ba672e8 commit c4585e2

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

spec/generators/rspec/scaffold/scaffold_generator_spec.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,19 @@
118118
it { is_expected.to contain(' Post.create') }
119119
end
120120

121-
describe 'with --model-name & --api' do
122-
before { run_generator %w[admin/posts --api --model-name=post] }
123-
it { is_expected.to contain('params: { post: valid_attributes }') }
124-
it { is_expected.not_to contain('params: { admin_post: valid_attributes }') }
121+
context 'with --api' do
122+
describe 'with default options' do
123+
before { run_generator %w[admin/posts --api] }
124+
it { is_expected.to contain('params: { admin_post: valid_attributes }') }
125+
it { is_expected.to contain('Admin::Post.create') }
126+
end
127+
128+
describe 'with --model-name' do
129+
before { run_generator %w[admin/posts --api --model-name=post] }
130+
it { is_expected.to contain('params: { post: valid_attributes }') }
131+
it { is_expected.not_to contain('params: { admin_post: valid_attributes }') }
132+
it { is_expected.to contain(' Post.create') }
133+
end
125134
end
126135
end
127136

0 commit comments

Comments
 (0)