diff --git a/lib/capybara/minitest.rb b/lib/capybara/minitest.rb index 5f39bad80..5460a77c1 100644 --- a/lib/capybara/minitest.rb +++ b/lib/capybara/minitest.rb @@ -48,7 +48,26 @@ module Assertions # @!method assert_no_current_path # See {Capybara::SessionMatchers#assert_no_current_path} - %w[text no_text title no_title current_path no_current_path].each do |assertion_name| + ## + # Assert all of the provided selectors exist on page + # + # @!method assert_all_of_selectors + # See {Capybara::Node::Matchers#assert_all_of_selectors} + + ## + # Assert none of the provided selectors exist on page + # + # @!method assert_none_of_selectors + # See {Capybara::Node::Matchers#assert_none_of_selectors} + + ## + # Assert any of the provided selectors exist on page + # + # @!method assert_any_of_selectors + # See {Capybara::Node::Matchers#assert_any_of_selectors} + + %w[text no_text title no_title current_path no_current_path + all_of_selectors none_of_selectors any_of_selectors].each do |assertion_name| class_eval <<-ASSERTION, __FILE__, __LINE__ + 1 def assert_#{assertion_name}(*args, **kwargs, &optional_filter_block) self.assertions +=1 @@ -93,24 +112,6 @@ def assert_#{assertion_name}(*args, **kwargs, &optional_filter_block) # @!method assert_not_matches_selector # See {Capybara::Node::Matchers#assert_not_matches_selector} - ## - # Assert all of the provided selectors exist on page - # - # @!method assert_all_of_selectors - # See {Capybara::Node::Matchers#assert_all_of_selectors} - - ## - # Assert none of the provided selectors exist on page - # - # @!method assert_none_of_selectors - # See {Capybara::Node::Matchers#assert_none_of_selectors} - - ## - # Assert any of the provided selectors exist on page - # - # @!method assert_any_of_selectors - # See {Capybara::Node::Matchers#assert_any_of_selectors} - ## # Assert element has the provided CSS styles # @@ -144,7 +145,6 @@ def assert_#{assertion_name}(*args, **kwargs, &optional_filter_block) # See {Capybara::Node::Matchers#assert_no_ancestor} %w[selector no_selector matches_style - all_of_selectors none_of_selectors any_of_selectors matches_selector not_matches_selector sibling no_sibling ancestor no_ancestor].each do |assertion_name| class_eval <<-ASSERTION, __FILE__, __LINE__ + 1 diff --git a/spec/minitest_spec.rb b/spec/minitest_spec.rb index 69dd2d77f..63a7fbbb5 100644 --- a/spec/minitest_spec.rb +++ b/spec/minitest_spec.rb @@ -110,7 +110,7 @@ def test_assert_table end def test_assert_all_of_selectors - assert_all_of_selectors(:css, 'select#form_other_title', 'input#form_last_name') + assert_all_of_selectors(:css, 'select#form_other_title', 'input#form_super_secret', visible: false) end def test_assert_none_of_selectors diff --git a/spec/minitest_spec_spec.rb b/spec/minitest_spec_spec.rb index 7bac58c23..80dfe4d02 100644 --- a/spec/minitest_spec_spec.rb +++ b/spec/minitest_spec_spec.rb @@ -95,7 +95,7 @@ def self.test_order end it 'supports all_of_selectors expectations' do - _(page).must_have_all_of_selectors(:css, 'select#form_other_title', 'input#form_last_name') + _(page).must_have_all_of_selectors(:css, 'select#form_other_title', 'input#form_super_secret', visible: false) end it 'supports none_of_selectors expectations' do