diff --git a/lib/capybara/rspec/matchers/have_selector.rb b/lib/capybara/rspec/matchers/have_selector.rb index 719be77d..075847e8 100644 --- a/lib/capybara/rspec/matchers/have_selector.rb +++ b/lib/capybara/rspec/matchers/have_selector.rb @@ -64,7 +64,7 @@ module Capybara el.assert_any_of_selectors(*@args, **session_query_options, &@filter_block) end - def does_not_match?(_actual) + def does_not_match?(el) el.assert_none_of_selectors(*@args, **session_query_options, &@filter_block) end diff --git a/lib/capybara/spec/session/has_any_selectors_spec.rb b/lib/capybara/spec/session/has_any_selectors_spec.rb index 3cbd3e86..54bd3c94 100644 --- a/lib/capybara/spec/session/has_any_selectors_spec.rb +++ b/lib/capybara/spec/session/has_any_selectors_spec.rb @@ -22,4 +22,8 @@ Capybara::SpecHelper.spec '#have_any_of_selectors' do expect(@session).to have_any_of_selectors('p a#blah', 'h2#h2three') end.to raise_error ::RSpec::Expectations::ExpectationNotMetError end + + it 'should be negateable' do + expect(@session).not_to have_any_of_selectors(:css, 'span a#foo', 'h2#h2nope', 'h2#h2one_no') + end end