-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate top_level_group? and test it in a Cop class
In this PR, we add a deprecation message for top_level_group?, which has no callers in current Rubocop/RSpec. The specs for this change complete line coverage for this repo.
- Loading branch information
1 parent
530af44
commit b7d0877
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe RuboCop::Cop::RSpec::TopLevelGroup do | ||
describe '#top_level_group?' do | ||
let(:stub_class) do | ||
Class.new do | ||
include RuboCop::Cop::RSpec::TopLevelGroup | ||
|
||
def initialize | ||
@top_level_groups = [] | ||
end | ||
|
||
def test_top_level_group | ||
top_level_group?(nil) | ||
end | ||
end | ||
end | ||
|
||
it 'warns because it is deprecated' do | ||
expect { stub_class.new.test_top_level_group }.to \ | ||
output(/warning: top_level_group\? is deprecated/).to_stderr | ||
end | ||
end | ||
end |