lib/rubocop/rspec/language.rb in rubocop-rspec-1.32.0 vs lib/rubocop/rspec/language.rb in rubocop-rspec-1.33.0
- old
+ new
@@ -2,10 +2,12 @@
module RuboCop
module RSpec
# RSpec public API methods that are commonly used in cops
module Language
+ RSPEC = '{(const nil? :RSpec) nil?}'
+
# Set of method selectors
class SelectorSet
def initialize(selectors)
@selectors = selectors
end
@@ -25,11 +27,11 @@
def block_pattern
"(block #{send_pattern} ...)"
end
def send_pattern
- "(send {(const nil? :RSpec) nil?} #{node_pattern_union} ...)"
+ "(send #{RSPEC} #{node_pattern_union} ...)"
end
def node_pattern_union
"{#{node_pattern}}"
end
@@ -104,16 +106,21 @@
module Expectations
ALL = SelectorSet.new(%i[expect is_expected expect_any_instance_of])
end
+ module Runners
+ ALL = SelectorSet.new(%i[to to_not not_to])
+ end
+
ALL =
ExampleGroups::ALL +
SharedGroups::ALL +
Examples::ALL +
Hooks::ALL +
Helpers::ALL +
Subject::ALL +
- Expectations::ALL
+ Expectations::ALL +
+ Runners::ALL
end
end
end