Module: Capybara::Minitest::Assertions

Defined in:
lib/capybara/minitest.rb

Instance Method Summary collapse

Instance Method Details

#assert_all_of_selectorsObject


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

#assert_ancestorObject


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

#assert_any_of_selectorsObject


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

#assert_buttonObject


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

#assert_checked_fieldObject


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

#assert_cssObject


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

#assert_current_pathObject


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

#assert_fieldObject


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


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

#assert_matches_cssObject


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

#assert_matches_selectorObject


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

#assert_matches_styleObject


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

#assert_matches_xpathObject


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

#assert_no_ancestorObject Also known as: refute_ancestor


146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# 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_buttonObject


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

#assert_no_checked_fieldObject

Assert that provided checked_field does not exist


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

#assert_no_cssObject


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

#assert_no_current_pathObject Also known as: refute_current_path


51
52
53
54
55
56
57
58
59
60
61
# 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)
      self.assertions +=1
      subject, args = determine_subject(args)
      subject.assert_#{assertion_name}(*args, **kwargs)
    rescue Capybara::ExpectationNotMet => e
      raise ::Minitest::Assertion, e.message
    end
  ASSERTION
end

#assert_no_fieldObject


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

Assert that provided link does not exist


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

#assert_no_selectObject


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

#assert_no_selectorObject Also known as: refute_selector


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

#assert_no_siblingObject Also known as: refute_sibling


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

#assert_no_tableObject


284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/capybara/minitest.rb', line 284

%w[xpath css 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_textObject Also known as: refute_text


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

#assert_no_titleObject Also known as: refute_title


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

#assert_no_unchecked_fieldObject

Assert that provided unchecked field does not exist


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

#assert_no_xpathObject


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

#assert_none_of_selectorsObject


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

#assert_not_matches_cssObject


350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/capybara/minitest.rb', line 350

%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_selectorObject Also known as: refute_matches_selector


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

#assert_not_matches_xpathObject


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

#assert_selectObject


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

#assert_selectorObject


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

#assert_siblingObject


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

#assert_tableObject


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

#assert_textObject Also known as: assert_content


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

#assert_titleObject


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

#assert_unchecked_fieldObject


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

#assert_xpathObject


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

#refute_buttonObject

Assert that provided button does not exist


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

#refute_checked_fieldObject


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

#refute_cssObject

Assert that provided css does not exist


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

#refute_fieldObject

Assert that provided field does not exist


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


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

#refute_matches_cssObject

Assert that element matches css


350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/capybara/minitest.rb', line 350

%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_xpathObject

Assert that element does not match xpath


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

#refute_selectObject

Assert that provided select does not exist


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

#refute_tableObject

Assert that provided table does not exist


284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/capybara/minitest.rb', line 284

%w[xpath css 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_unchecked_fieldObject


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

#refute_xpathObject

Assert that provide xpath does not exist


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