spec/rubocop/cop/rspec/rails/http_status_spec.rb in rubocop-rspec-1.23.0 vs spec/rubocop/cop/rspec/rails/http_status_spec.rb in rubocop-rspec-1.24.0

- old
+ new

@@ -17,10 +17,16 @@ expect_no_offenses(<<-RUBY) it { is_expected.to have_http_status :ok } RUBY end + it 'does not register an offense when using custom HTTP code' do + expect_no_offenses(<<-RUBY) + it { is_expected.to have_http_status 550 } + RUBY + end + include_examples 'autocorrect', 'it { is_expected.to have_http_status 200 }', 'it { is_expected.to have_http_status :ok }' include_examples 'autocorrect', @@ -34,21 +40,10 @@ include_examples 'autocorrect', 'it { is_expected.to have_http_status(404) }', 'it { is_expected.to have_http_status(:not_found) }' end - - context 'when rack is not loaded' do - before { stub_const("#{described_class}::RACK_LOADED", false) } - - it 'registers an offense when using numeric value' do - expect_offense(<<-RUBY) - it { is_expected.to have_http_status 200 } - ^^^ Prefer `symbolic` over `numeric` to describe HTTP status code. - RUBY - end - end end context 'when EnforcedStyle is `numeric`' do let(:cop_config) { { 'EnforcedStyle' => 'numeric' } } @@ -88,19 +83,8 @@ 'it { is_expected.to have_http_status(200) }' include_examples 'autocorrect', 'it { is_expected.to have_http_status(:not_found) }', 'it { is_expected.to have_http_status(404) }' - end - - context 'when rack is not loaded' do - before { stub_const("#{described_class}::RACK_LOADED", false) } - - it 'registers an offense when using numeric value' do - expect_offense(<<-RUBY) - it { is_expected.to have_http_status :ok } - ^^^ Prefer `numeric` over `symbolic` to describe HTTP status code. - RUBY - end end end end