Skip to content

Commit 7ae719f

Browse files
committed
Add test coverage for when rack gem is not loaded
1 parent 8723f81 commit 7ae719f

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.simplecov

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
SimpleCov.start do
44
enable_coverage :branch
5-
minimum_coverage line: 100, branch: 98.41
5+
minimum_coverage line: 100, branch: 100
66
add_filter '/spec/'
77
add_filter '/vendor/bundle/'
88
end

spec/rubocop/cop/rspec_rails/http_status_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@
8989

9090
expect_no_corrections
9191
end
92+
93+
it 'registers no offense when Rack is not loaded' do
94+
hide_const('Rack')
95+
96+
expect_no_offenses(<<~RUBY)
97+
it { is_expected.to have_http_status(404) }
98+
RUBY
99+
end
92100
end
93101

94102
context 'when EnforcedStyle is `numeric`' do
@@ -163,6 +171,14 @@
163171
RUBY
164172
end
165173
end
174+
175+
it 'registers no offense when Rack is not loaded' do
176+
hide_const('Rack')
177+
178+
expect_no_offenses(<<~RUBY)
179+
it { is_expected.to have_http_status(:not_found) }
180+
RUBY
181+
end
166182
end
167183

168184
context 'when EnforcedStyle is `be_status`' do
@@ -287,5 +303,13 @@
287303
RUBY
288304
end
289305
end
306+
307+
it 'registers no offense when Rack is not loaded' do
308+
hide_const('Rack')
309+
310+
expect_no_offenses(<<~RUBY)
311+
it { is_expected.to have_http_status(:not_found) }
312+
RUBY
313+
end
290314
end
291315
end

0 commit comments

Comments
 (0)