Skip to content

Commit

Permalink
Loosen the dependency on RSpec::Base
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Dec 11, 2022
1 parent 63908ab commit f8340c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/rubocop/cop/rspec/capybara/current_path_expectation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ class CurrentPathExpectation < Base
# @!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

Expand Down
5 changes: 3 additions & 2 deletions lib/rubocop/cop/rspec/rails/have_http_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ class HaveHttpStatus < Base
'Prefer `expect(response).%<to>s have_http_status(%<status>i)` ' \
'over `expect(response.status).%<to>s %<match>s`.'

RESTRICT_ON_SEND = Runners.all
RUNNERS = %i[to to_not not_to].to_set
RESTRICT_ON_SEND = RUNNERS

# @!method match_status(node)
def_node_matcher :match_status, <<-PATTERN
(send
(send nil? :expect
$(send (send nil? :response) :status)
)
$#Runners.all
$RUNNERS
$(send nil? {:be :eq :eql :equal} (int $_))
)
PATTERN
Expand Down

0 comments on commit f8340c0

Please sign in to comment.