Skip to content

Commit

Permalink
Merge pull request #2029 from corsonknowles/add_branch_cover_for_impl…
Browse files Browse the repository at this point in the history
…icit_subject

Add branch coverage for `RSpec/ImplicitSubject`
  • Loading branch information
bquorning authored Feb 9, 2025
2 parents e223436 + a3851b7 commit 837c7d7
Show file tree
Hide file tree
Showing 2 changed files with 15 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: 97.94
minimum_coverage line: 100, branch: 98.44
add_filter '/spec/'
add_filter '/vendor/bundle/'
end
14 changes: 14 additions & 0 deletions spec/rubocop/cop/rspec/implicit_subject_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ def permits(actions)
end
RUBY
end

it 'does not flag is_expected in describe blocks (non-example contexts)' do
expect_no_offenses(<<~RUBY)
describe 'something' do
is_expected.to be_valid
end
RUBY
end

it 'does not flag an empty example' do
expect_no_offenses(<<~RUBY)
it('is valid') { }
RUBY
end
end

context 'with EnforcedStyle `disallow`' do
Expand Down

0 comments on commit 837c7d7

Please sign in to comment.