Skip to content

Commit 2cd3a31

Browse files
committed
Fix message of RSpec/Rails/HaveHttpStatus
1 parent 88aa504 commit 2cd3a31

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/rubocop/cop/rspec/rails/have_http_status.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ module Rails
1616
class HaveHttpStatus < Base
1717
extend AutoCorrector
1818

19-
MSG = 'Prefer `expect(response.status).%<to>s %<match>s` ' \
20-
'over `expect(response).%<to>s have_http_status(%<status>i)`.'
19+
MSG =
20+
'Prefer `expect(response).%<to>s have_http_status(%<status>i)` ' \
21+
'over `expect(response.status).%<to>s %<match>s`.'
2122

2223
# @!method match_status(node)
2324
def_node_matcher :match_status, <<-PATTERN

spec/rubocop/cop/rspec/rails/have_http_status_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
it 'registers an offense for `expect(response.status).to be 200`' do
55
expect_offense(<<~RUBY)
66
it { expect(response.status).to be 200 }
7-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response.status).to be 200` over `expect(response).to have_http_status(200)`.
7+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).to have_http_status(200)` over `expect(response.status).to be 200`.
88
RUBY
99

1010
expect_correction(<<~RUBY)
@@ -15,7 +15,7 @@
1515
it 'registers an offense for `expect(response.status).not_to eq 404`' do
1616
expect_offense(<<~RUBY)
1717
it { expect(response.status).not_to eq(404) }
18-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response.status).not_to eq(404)` over `expect(response).not_to have_http_status(404)`.
18+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).not_to have_http_status(404)` over `expect(response.status).not_to eq(404)`.
1919
RUBY
2020

2121
expect_correction(<<~RUBY)

0 commit comments

Comments
 (0)