|
5 | 5 | RSpec.describe Rspec::Generators::ScaffoldGenerator, type: :generator do
|
6 | 6 | setup_default_destination
|
7 | 7 |
|
| 8 | + describe 'standard request specs' do |
| 9 | + subject { file('spec/requests/posts_request_spec.rb') } |
| 10 | + |
| 11 | + describe 'with --request_specs' do |
| 12 | + before { run_generator %w[posts --request_specs] } |
| 13 | + it { is_expected.to exist } |
| 14 | + end |
| 15 | + |
| 16 | + describe 'with no options' do |
| 17 | + before { run_generator %w[posts] } |
| 18 | + it { is_expected.not_to exist } |
| 19 | + end |
| 20 | + end |
| 21 | + |
8 | 22 | describe 'standard controller spec' do
|
9 | 23 | subject { file('spec/controllers/posts_controller_spec.rb') }
|
10 | 24 |
|
11 | 25 | describe 'with no options' do
|
12 |
| - before { run_generator %w(posts) } |
| 26 | + before { run_generator %w[posts] } |
13 | 27 | it { is_expected.to contain(/require 'rails_helper'/) }
|
14 | 28 | it { is_expected.to contain(/^RSpec.describe PostsController, #{type_metatag(:controller)}/) }
|
15 | 29 | it { is_expected.to contain(/GET #new/) }
|
|
28 | 42 | end
|
29 | 43 |
|
30 | 44 | describe 'with --no-controller_specs' do
|
31 |
| - before { run_generator %w(posts --no-controller_specs) } |
| 45 | + before { run_generator %w[posts --no-controller_specs] } |
32 | 46 | it { is_expected.not_to exist }
|
33 | 47 | end
|
34 | 48 |
|
35 | 49 | describe 'with --api' do
|
36 |
| - before { run_generator %w(posts --api) } |
| 50 | + before { run_generator %w[posts --api] } |
37 | 51 | it { is_expected.to contain(/require 'rails_helper'/) }
|
38 | 52 | it { is_expected.to contain(/^RSpec.describe PostsController, #{type_metatag(:controller)}/) }
|
39 | 53 | it { is_expected.not_to contain(/GET #new/) }
|
|
51 | 65 | end
|
52 | 66 | end
|
53 | 67 |
|
| 68 | + describe 'namespaced request spec' do |
| 69 | + subject { file('spec/requests/admin/posts_request_spec.rb') } |
| 70 | + before { run_generator %w[admin/posts --request_specs] } |
| 71 | + it { is_expected.to exist } |
| 72 | + end |
| 73 | + |
54 | 74 | describe 'namespaced controller spec' do
|
55 | 75 | subject { file('spec/controllers/admin/posts_controller_spec.rb') }
|
56 |
| - before { run_generator %w(admin/posts) } |
57 |
| - it { is_expected.to contain(/^RSpec.describe Admin::PostsController, #{type_metatag(:controller)}/)} |
| 76 | + before { run_generator %w[admin/posts] } |
| 77 | + it { is_expected.to contain(/^RSpec.describe Admin::PostsController, #{type_metatag(:controller)}/) } |
58 | 78 | end
|
59 | 79 |
|
60 | 80 | describe 'view specs' do
|
|
0 commit comments