lib/rubocop/cop/rspec/capybara/current_path_expectation.rb in rubocop-rspec-2.15.0 vs lib/rubocop/cop/rspec/capybara/current_path_expectation.rb in rubocop-rspec-2.16.0
- old
+ new
@@ -27,11 +27,11 @@
# expect(page.current_path).to match(variable)
#
# # good
# expect(page).to have_current_path('/callback')
#
- class CurrentPathExpectation < Base
+ class CurrentPathExpectation < ::RuboCop::Cop::Base
extend AutoCorrector
MSG = 'Do not set an RSpec expectation on `current_path` in ' \
'Capybara feature specs - instead, use the ' \
'`have_current_path` matcher on `page`'
@@ -45,17 +45,17 @@
# Supported matchers: eq(...) / match(/regexp/) / match('regexp')
# @!method as_is_matcher(node)
def_node_matcher :as_is_matcher, <<-PATTERN
(send
- #expectation_set_on_current_path $#Runners.all
+ #expectation_set_on_current_path ${:to :to_not :not_to}
${(send nil? :eq ...) (send nil? :match (regexp ...))})
PATTERN
# @!method regexp_str_matcher(node)
def_node_matcher :regexp_str_matcher, <<-PATTERN
(send
- #expectation_set_on_current_path $#Runners.all
+ #expectation_set_on_current_path ${:to :to_not :not_to}
$(send nil? :match (str $_)))
PATTERN
def self.autocorrect_incompatible_with
[Style::TrailingCommaInArguments]