Skip to content

Commit

Permalink
Add test coverage for when rack gem is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
bquorning committed Feb 12, 2025
1 parent ddc2f14 commit 362c6a9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

SimpleCov.start do
enable_coverage :branch
minimum_coverage line: 100, branch: 98.41
minimum_coverage line: 100, branch: 100
add_filter '/spec/'
add_filter '/vendor/bundle/'
end
24 changes: 24 additions & 0 deletions spec/rubocop/cop/rspec_rails/http_status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@

expect_no_corrections
end

it 'registers no offense when Rack is not loaded' do
hide_const('Rack')

expect_no_offenses(<<~RUBY)
it { is_expected.to have_http_status(404) }
RUBY
end
end

context 'when EnforcedStyle is `numeric`' do
Expand Down Expand Up @@ -163,6 +171,14 @@
RUBY
end
end

it 'registers no offense when Rack is not loaded' do
hide_const('Rack')

expect_no_offenses(<<~RUBY)
it { is_expected.to have_http_status(:not_found) }
RUBY
end
end

context 'when EnforcedStyle is `be_status`' do
Expand Down Expand Up @@ -287,5 +303,13 @@
RUBY
end
end

it 'registers no offense when Rack is not loaded' do
hide_const('Rack')

expect_no_offenses(<<~RUBY)
it { is_expected.to have_http_status(:not_found) }
RUBY
end
end
end

0 comments on commit 362c6a9

Please sign in to comment.