Skip to content

Commit beaca32

Browse files
committed
Fix pending cop when skip is a string
fixes #840
1 parent 95e0788 commit beaca32

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Implement `RSpec/DescribedClassModuleWrapping` to disallow RSpec statements within a module. ([@kellysutton][])
66
* Fix documentation rake task to support Rubocop 0.75. ([@nickcampbell18][])
77
* Fix `RSpec/SubjectStub` to detect implicit subjects stubbed. ([@QQism][])
8+
* Fix `RSpec/Pending` not flagging `skip` with string values. ([@pirj][])
89

910
## 1.36.0 (2019-09-27)
1011

lib/rubocop/cop/rspec/pending.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Pending < Cop
4242
def_node_matcher :skipped_in_metadata?, <<-PATTERN
4343
{
4444
(send _ _ <#skip_or_pending? ...>)
45-
(send _ _ ... (hash <(pair #skip_or_pending? true) ...>))
45+
(send _ _ ... (hash <(pair #skip_or_pending? { true str }) ...>))
4646
}
4747
PATTERN
4848

spec/rubocop/cop/rspec/pending_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@
108108
RUBY
109109
end
110110

111+
it 'flags blocks with skip: string metadata' do
112+
expect_offense(<<-RUBY)
113+
it 'test', skip: 'skipped because of being slow' do
114+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pending spec found.
115+
end
116+
RUBY
117+
end
118+
111119
it 'flags pending blocks' do
112120
expect_offense(<<-RUBY)
113121
pending 'test' do

0 commit comments

Comments
 (0)