|
192 | 192 | it { is_expected.to exist }
|
193 | 193 | it { is_expected.to contain(/require 'rails_helper'/) }
|
194 | 194 | it { is_expected.to contain(/^RSpec.describe "(.*)\/edit", #{type_metatag(:view)}/) }
|
| 195 | + it { is_expected.to contain(/assign\(:post, post\)/) } |
195 | 196 | it { is_expected.to contain(/it "renders the edit (.*) form"/) }
|
196 | 197 | end
|
197 | 198 |
|
|
200 | 201 | it { is_expected.to exist }
|
201 | 202 | it { is_expected.to contain(/require 'rails_helper'/) }
|
202 | 203 | it { is_expected.to contain(/^RSpec.describe "(.*)\/index", #{type_metatag(:view)}/) }
|
| 204 | + it { is_expected.to contain(/assign\(:posts, /) } |
203 | 205 | it { is_expected.to contain(/it "renders a list of (.*)"/) }
|
204 | 206 | end
|
205 | 207 |
|
|
208 | 210 | it { is_expected.to exist }
|
209 | 211 | it { is_expected.to contain(/require 'rails_helper'/) }
|
210 | 212 | it { is_expected.to contain(/^RSpec.describe "(.*)\/new", #{type_metatag(:view)}/) }
|
| 213 | + it { is_expected.to contain(/assign\(:post, /) } |
211 | 214 | it { is_expected.to contain(/it "renders new (.*) form"/) }
|
212 | 215 | end
|
213 | 216 |
|
|
216 | 219 | it { is_expected.to exist }
|
217 | 220 | it { is_expected.to contain(/require 'rails_helper'/) }
|
218 | 221 | it { is_expected.to contain(/^RSpec.describe "(.*)\/show", #{type_metatag(:view)}/) }
|
| 222 | + it { is_expected.to contain(/assign\(:post, /) } |
219 | 223 | it { is_expected.to contain(/it "renders attributes in <p>"/) }
|
220 | 224 | end
|
221 | 225 | end
|
|
251 | 255 | end
|
252 | 256 | end
|
253 | 257 |
|
| 258 | + describe 'with namespace' do |
| 259 | + before { run_generator %w[admin/posts] } |
| 260 | + |
| 261 | + describe 'edit' do |
| 262 | + subject { file("spec/views/admin/posts/edit.html.erb_spec.rb") } |
| 263 | + it { is_expected.to exist } |
| 264 | + it { is_expected.to contain(/assign\(:admin_post, admin_post\)/) } |
| 265 | + end |
| 266 | + |
| 267 | + describe 'index' do |
| 268 | + subject { file("spec/views/admin/posts/index.html.erb_spec.rb") } |
| 269 | + it { is_expected.to exist } |
| 270 | + it { is_expected.to contain(/assign\(:admin_posts, /) } |
| 271 | + end |
| 272 | + |
| 273 | + describe 'new' do |
| 274 | + subject { file("spec/views/admin/posts/new.html.erb_spec.rb") } |
| 275 | + it { is_expected.to exist } |
| 276 | + it { is_expected.to contain(/assign\(:admin_post, /) } |
| 277 | + end |
| 278 | + |
| 279 | + describe 'show' do |
| 280 | + subject { file("spec/views/admin/posts/show.html.erb_spec.rb") } |
| 281 | + it { is_expected.to exist } |
| 282 | + it { is_expected.to contain(/assign\(:admin_post, /) } |
| 283 | + end |
| 284 | + end |
| 285 | + |
| 286 | + describe 'with namespace and --model-name' do |
| 287 | + before { run_generator %w[admin/posts --model-name=Post] } |
| 288 | + |
| 289 | + describe 'edit' do |
| 290 | + subject { file("spec/views/admin/posts/edit.html.erb_spec.rb") } |
| 291 | + it { is_expected.to exist } |
| 292 | + it { is_expected.to contain(/assign\(:post, post\)/) } |
| 293 | + end |
| 294 | + |
| 295 | + describe 'index' do |
| 296 | + subject { file("spec/views/admin/posts/index.html.erb_spec.rb") } |
| 297 | + it { is_expected.to exist } |
| 298 | + it { is_expected.to contain(/assign\(:posts, /) } |
| 299 | + end |
| 300 | + |
| 301 | + describe 'new' do |
| 302 | + subject { file("spec/views/admin/posts/new.html.erb_spec.rb") } |
| 303 | + it { is_expected.to exist } |
| 304 | + it { is_expected.to contain(/assign\(:post, /) } |
| 305 | + end |
| 306 | + |
| 307 | + describe 'show' do |
| 308 | + subject { file("spec/views/admin/posts/show.html.erb_spec.rb") } |
| 309 | + it { is_expected.to exist } |
| 310 | + it { is_expected.to contain(/assign\(:post, /) } |
| 311 | + end |
| 312 | + end |
| 313 | + |
254 | 314 | describe 'with --no-template-engine' do
|
255 | 315 | before { run_generator %w[posts --no-template-engine] }
|
256 | 316 | describe 'edit' do
|
|
0 commit comments