Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions lib/capybara/minitest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/minitest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/minitest_spec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down