Skip to content

Commit

Permalink
Don't omit parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
akiomik committed Jun 30, 2022
1 parent 2cd3a31 commit eb40985
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions spec/rubocop/cop/rspec/rails/have_http_status_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::RSpec::Rails::HaveHttpStatus do
it 'registers an offense for `expect(response.status).to be 200`' do
it 'registers an offense for `expect(response.status).to be(200)`' do
expect_offense(<<~RUBY)
it { expect(response.status).to be 200 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).to have_http_status(200)` over `expect(response.status).to be 200`.
it { expect(response.status).to be(200) }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).to have_http_status(200)` over `expect(response.status).to be(200)`.
RUBY

expect_correction(<<~RUBY)
it { expect(response).to have_http_status 200 }
it { expect(response).to have_http_status(200) }
RUBY
end

it 'registers an offense for `expect(response.status).not_to eq 404`' do
it 'registers an offense for `expect(response.status).not_to eq(404)`' do
expect_offense(<<~RUBY)
it { expect(response.status).not_to eq(404) }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `expect(response).not_to have_http_status(404)` over `expect(response.status).not_to eq(404)`.
Expand All @@ -23,15 +23,15 @@
RUBY
end

it 'does not register an offense for `is_expected.to be 200`' do
it 'does not register an offense for `is_expected.to be(200)`' do
expect_no_offenses(<<~RUBY)
it { is_expected.to be 200 }
it { is_expected.to be(200) }
RUBY
end

it 'does not register an offense for `expect(res.status).to be 200`' do
it 'does not register an offense for `expect(res.status).to be(200)`' do
expect_no_offenses(<<~RUBY)
it { expect(res.status).to be 200 }
it { expect(res.status).to be(200) }
RUBY
end
end

0 comments on commit eb40985

Please sign in to comment.