|
8 | 8 | describe 'request specs' do
|
9 | 9 | subject { file('spec/requests/posts_request_spec.rb') }
|
10 | 10 |
|
11 |
| - if Rails.version.to_f >= 5.0 |
12 |
| - describe 'generated by default' do |
13 |
| - before do |
14 |
| - run_generator %w[posts] |
15 |
| - end |
| 11 | + describe 'generated by default' do |
| 12 | + before do |
| 13 | + run_generator %w[posts] |
| 14 | + end |
16 | 15 |
|
17 |
| - describe 'the spec' do |
18 |
| - it { is_expected.to exist } |
19 |
| - it { is_expected.to contain(/require 'rails_helper'/) } |
20 |
| - it { is_expected.to contain(/^RSpec.describe "Posts", #{type_metatag(:request)}/) } |
21 |
| - end |
| 16 | + describe 'the spec' do |
| 17 | + it { is_expected.to exist } |
| 18 | + it { is_expected.to contain(/require 'rails_helper'/) } |
| 19 | + it { is_expected.to contain(/^RSpec.describe "Posts", #{type_metatag(:request)}/) } |
22 | 20 | end
|
| 21 | + end |
23 | 22 |
|
24 |
| - describe 'skipped with a flag' do |
25 |
| - before do |
26 |
| - run_generator %w[posts --no-request_specs] |
27 |
| - end |
28 |
| - it { is_expected.not_to exist } |
| 23 | + describe 'skipped with a flag' do |
| 24 | + before do |
| 25 | + run_generator %w[posts --no-request_specs] |
29 | 26 | end
|
30 |
| - else |
31 | 27 | it { is_expected.not_to exist }
|
32 | 28 | end
|
33 | 29 | end
|
|
137 | 133 | describe 'controller specs' do
|
138 | 134 | subject { file('spec/controllers/posts_controller_spec.rb') }
|
139 | 135 |
|
140 |
| - if Rails.version.to_f < 5.0 |
141 |
| - describe 'generated by default' do |
142 |
| - before do |
143 |
| - run_generator %w[posts] |
144 |
| - end |
145 |
| - |
146 |
| - describe 'the spec' do |
147 |
| - it { is_expected.to exist } |
148 |
| - it { is_expected.to contain(/require 'rails_helper'/) } |
149 |
| - it { is_expected.to contain(/^RSpec.describe PostsController, #{type_metatag(:controller)}/) } |
150 |
| - end |
151 |
| - end |
| 136 | + describe 'are not generated' do |
| 137 | + it { is_expected.not_to exist } |
| 138 | + end |
152 | 139 |
|
153 |
| - describe 'skipped with a flag' do |
154 |
| - before do |
155 |
| - run_generator %w[posts --no-controller-specs] |
156 |
| - end |
157 |
| - it { is_expected.not_to exist } |
158 |
| - end |
159 |
| - else |
160 |
| - describe 'are not generated' do |
161 |
| - it { is_expected.not_to exist } |
| 140 | + describe 'with --controller-specs flag' do |
| 141 | + before do |
| 142 | + run_generator %w[posts --controller-specs] |
162 | 143 | end
|
163 | 144 |
|
164 |
| - describe 'with --controller-specs flag' do |
165 |
| - before do |
166 |
| - run_generator %w[posts --controller-specs] |
167 |
| - end |
168 |
| - |
169 |
| - describe 'the spec' do |
170 |
| - it { is_expected.to exist } |
171 |
| - it { is_expected.to contain(/require 'rails_helper'/) } |
172 |
| - it { is_expected.to contain(/^RSpec.describe PostsController, #{type_metatag(:controller)}/) } |
173 |
| - end |
| 145 | + describe 'the spec' do |
| 146 | + it { is_expected.to exist } |
| 147 | + it { is_expected.to contain(/require 'rails_helper'/) } |
| 148 | + it { is_expected.to contain(/^RSpec.describe PostsController, #{type_metatag(:controller)}/) } |
174 | 149 | end
|
| 150 | + end |
175 | 151 |
|
176 |
| - describe 'with --no-controller_specs flag' do |
177 |
| - before do |
178 |
| - run_generator %w[posts --no-controller-specs] |
179 |
| - end |
180 |
| - it { is_expected.not_to exist } |
| 152 | + describe 'with --no-controller_specs flag' do |
| 153 | + before do |
| 154 | + run_generator %w[posts --no-controller-specs] |
181 | 155 | end
|
| 156 | + it { is_expected.not_to exist } |
182 | 157 | end
|
183 | 158 | end
|
184 | 159 | end
|
0 commit comments