123456789_123456789_123456789_123456789_123456789_

Module: Capybara::Minitest::Assertions

Relationships & Source Files
Defined in: lib/capybara/minitest.rb

Instance Method Summary

Instance Method Details

#assert_all_of_selectors

[ GitHub ]

#assert_ancestor

[ GitHub ]

#assert_any_of_selectors

[ GitHub ]

#assert_button

[ GitHub ]

#assert_checked_field

[ GitHub ]

#assert_content

Alias for #assert_text.

#assert_css

[ GitHub ]

#assert_current_path

[ GitHub ]

#assert_element

[ GitHub ]

#assert_field

[ GitHub ]

#assert_matches_css

[ GitHub ]

#assert_matches_selector

[ GitHub ]

#assert_matches_style

[ GitHub ]

#assert_matches_xpath

[ GitHub ]

#assert_no_ancestor Also known as: #refute_ancestor

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 146

%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
    def assert_#{assertion_name} *args, &optional_filter_block
      self.assertions +=1
      subject, args = determine_subject(args)
      subject.assert_#{assertion_name}(*args, &optional_filter_block)
    rescue Capybara::ExpectationNotMet => e
      raise ::Minitest::Assertion, e.message
    end
  ASSERTION
  ruby2_keywords "assert_#{assertion_name}" if respond_to?(:ruby2_keywords)
end

#assert_no_button

[ GitHub ]

#assert_no_checked_field

Assert that provided checked_field does not exist

[ GitHub ]

#assert_no_content

Alias for #refute_text.

#assert_no_css

[ GitHub ]

#assert_no_current_path Also known as: #refute_current_path

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 51

%w[text no_text title no_title current_path no_current_path].each do |assertion_name|
  class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
    def assert_#{assertion_name}(*args, **kwargs, &optional_filter_block)
      self.assertions +=1
      subject, args = determine_subject(args)
      subject.assert_#{assertion_name}(*args, **kwargs, &optional_filter_block)
    rescue Capybara::ExpectationNotMet => e
      raise ::Minitest::Assertion, e.message
    end
  ASSERTION
end

#assert_no_element

Assert that provided element does not exist

[ GitHub ]

#assert_no_field

[ GitHub ]

#assert_no_select

[ GitHub ]

#assert_no_selector Also known as: #refute_selector

[ GitHub ]

#assert_no_sibling Also known as: #refute_sibling

[ GitHub ]

#assert_no_table

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 297

%w[xpath css element link button field select table].each do |selector_type|
  define_method "assert_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    locator, options = extract_locator(args)
    assert_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
  end
  ruby2_keywords "assert_#{selector_type}" if respond_to?(:ruby2_keywords)

  define_method "assert_no_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    locator, options = extract_locator(args)
    assert_no_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
  end
  ruby2_keywords "assert_no_#{selector_type}" if respond_to?(:ruby2_keywords)
  alias_method "refute_#{selector_type}", "assert_no_#{selector_type}"
end

#assert_no_text Also known as: #refute_text

[ GitHub ]

#assert_no_title Also known as: #refute_title

[ GitHub ]

#assert_no_unchecked_field

Assert that provided unchecked field does not exist

[ GitHub ]

#assert_no_xpath

[ GitHub ]

#assert_none_of_selectors

[ GitHub ]

#assert_not_matches_css

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 363

%w[xpath css].each do |selector_type|
  define_method "assert_matches_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    assert_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
  end
  ruby2_keywords "assert_matches_#{selector_type}" if respond_to?(:ruby2_keywords)

  define_method "assert_not_matches_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    assert_not_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
  end
  ruby2_keywords "assert_not_matches_#{selector_type}" if respond_to?(:ruby2_keywords)
  alias_method "refute_matches_#{selector_type}", "assert_not_matches_#{selector_type}"
end

#assert_not_matches_selector Also known as: #refute_matches_selector

[ GitHub ]

#assert_not_matches_xpath

[ GitHub ]

#assert_select

[ GitHub ]

#assert_selector

[ GitHub ]

#assert_sibling

[ GitHub ]

#assert_table

[ GitHub ]

#assert_text Also known as: #assert_content

[ GitHub ]

#assert_title

[ GitHub ]

#assert_unchecked_field

[ GitHub ]

#assert_xpath

[ GitHub ]

#determine_subject(args) (private)

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 380

def determine_subject(args)
  case args.first
  when Capybara::Session, Capybara::Node::Base, Capybara::Node::Simple
    [args.shift, args]
  when ->(arg) { arg.respond_to?(:to_capybara_node) }
    [args.shift.to_capybara_node, args]
  else
    [page, args]
  end
end

#extract_locator(args) (private)

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 391

def extract_locator(args)
  locator, options = *args, {}
  locator, options = nil, locator if locator.is_a? Hash
  [locator, options]
end

#refute_ancestor

Alias for #assert_no_ancestor.

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 146

%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
    def assert_#{assertion_name} *args, &optional_filter_block
      self.assertions +=1
      subject, args = determine_subject(args)
      subject.assert_#{assertion_name}(*args, &optional_filter_block)
    rescue Capybara::ExpectationNotMet => e
      raise ::Minitest::Assertion, e.message
    end
  ASSERTION
  ruby2_keywords "assert_#{assertion_name}" if respond_to?(:ruby2_keywords)
end

#refute_button

Assert that provided button does not exist

[ GitHub ]

#refute_checked_field

[ GitHub ]

#refute_content

Alias for #refute_text.

#refute_css

Assert that provided css does not exist

[ GitHub ]

#refute_current_path

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 51

%w[text no_text title no_title current_path no_current_path].each do |assertion_name|
  class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
    def assert_#{assertion_name}(*args, **kwargs, &optional_filter_block)
      self.assertions +=1
      subject, args = determine_subject(args)
      subject.assert_#{assertion_name}(*args, **kwargs, &optional_filter_block)
    rescue Capybara::ExpectationNotMet => e
      raise ::Minitest::Assertion, e.message
    end
  ASSERTION
end

#refute_element

[ GitHub ]

#refute_field

Assert that provided field does not exist

[ GitHub ]

#refute_matches_css

Assert that element matches css

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 363

%w[xpath css].each do |selector_type|
  define_method "assert_matches_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    assert_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
  end
  ruby2_keywords "assert_matches_#{selector_type}" if respond_to?(:ruby2_keywords)

  define_method "assert_not_matches_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    assert_not_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
  end
  ruby2_keywords "assert_not_matches_#{selector_type}" if respond_to?(:ruby2_keywords)
  alias_method "refute_matches_#{selector_type}", "assert_not_matches_#{selector_type}"
end

#refute_matches_selector

#refute_matches_xpath

Assert that element does not match xpath

[ GitHub ]

#refute_select

Assert that provided select does not exist

[ GitHub ]

#refute_selector

Alias for #assert_no_selector.

#refute_sibling

Alias for #assert_no_sibling.

#refute_table

Assert that provided table does not exist

[ GitHub ]

  
# File 'lib/capybara/minitest.rb', line 297

%w[xpath css element link button field select table].each do |selector_type|
  define_method "assert_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    locator, options = extract_locator(args)
    assert_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
  end
  ruby2_keywords "assert_#{selector_type}" if respond_to?(:ruby2_keywords)

  define_method "assert_no_#{selector_type}" do |*args, &optional_filter_block|
    subject, args = determine_subject(args)
    locator, options = extract_locator(args)
    assert_no_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
  end
  ruby2_keywords "assert_no_#{selector_type}" if respond_to?(:ruby2_keywords)
  alias_method "refute_#{selector_type}", "assert_no_#{selector_type}"
end

#refute_text Also known as: #refute_content, #assert_no_content

Alias for #assert_no_text.

#refute_title

Alias for #assert_no_title.

#refute_unchecked_field

[ GitHub ]

#refute_xpath

Assert that provide xpath does not exist

[ GitHub ]