|
1 | 1 | # frozen_string_literal: true
|
2 | 2 |
|
3 | 3 | RSpec.describe RuboCop::Cop::RSpec::Rails::HaveHttpStatus do
|
4 |
| - it 'registers an offense for `expect(response.status).to be 200`' do |
| 4 | + it 'registers an offense for `expect(response.status).to be(200)`' do |
5 | 5 | expect_offense(<<~RUBY)
|
6 |
| - it { expect(response.status).to be 200 } |
7 |
| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).to have_http_status(200)` over `expect(response.status).to be 200`. |
| 6 | + it { expect(response.status).to be(200) } |
| 7 | + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).to have_http_status(200)` over `expect(response.status).to be(200)`. |
8 | 8 | RUBY
|
9 | 9 |
|
10 | 10 | expect_correction(<<~RUBY)
|
11 |
| - it { expect(response).to have_http_status 200 } |
| 11 | + it { expect(response).to have_http_status(200) } |
12 | 12 | RUBY
|
13 | 13 | end
|
14 | 14 |
|
15 |
| - it 'registers an offense for `expect(response.status).not_to eq 404`' do |
| 15 | + it 'registers an offense for `expect(response.status).not_to eq(404)`' do |
16 | 16 | expect_offense(<<~RUBY)
|
17 | 17 | it { expect(response.status).not_to eq(404) }
|
18 | 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).not_to have_http_status(404)` over `expect(response.status).not_to eq(404)`.
|
|
23 | 23 | RUBY
|
24 | 24 | end
|
25 | 25 |
|
26 |
| - it 'does not register an offense for `is_expected.to be 200`' do |
| 26 | + it 'does not register an offense for `is_expected.to be(200)`' do |
27 | 27 | expect_no_offenses(<<~RUBY)
|
28 |
| - it { is_expected.to be 200 } |
| 28 | + it { is_expected.to be(200) } |
29 | 29 | RUBY
|
30 | 30 | end
|
31 | 31 |
|
32 |
| - it 'does not register an offense for `expect(res.status).to be 200`' do |
| 32 | + it 'does not register an offense for `expect(res.status).to be(200)`' do |
33 | 33 | expect_no_offenses(<<~RUBY)
|
34 |
| - it { expect(res.status).to be 200 } |
| 34 | + it { expect(res.status).to be(200) } |
35 | 35 | RUBY
|
36 | 36 | end
|
37 | 37 | end
|
0 commit comments