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 97

#assert_ancestorObject


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

#assert_any_of_selectorsObject


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

#assert_buttonObject


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

#assert_checked_fieldObject


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

#assert_cssObject


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

#assert_current_pathObject


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

#assert_fieldObject


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


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

#assert_matches_cssObject


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

#assert_matches_selectorObject


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

#assert_matches_styleObject


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

#assert_matches_xpathObject


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

#assert_no_ancestorObject Also known as: refute_ancestor


147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/capybara/minitest.rb', line 147

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

#assert_no_checked_fieldObject

Assert that provided checked_field does not exist


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

#assert_no_cssObject


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

#assert_no_current_pathObject Also known as: refute_current_path


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

#assert_no_fieldObject


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

Assert that provided link does not exist


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

#assert_no_selectObject


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

#assert_no_selectorObject Also known as: refute_selector


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

#assert_no_siblingObject Also known as: refute_sibling


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

#assert_no_tableObject


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

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

#assert_no_xpathObject


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

#assert_none_of_selectorsObject


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

#assert_not_matches_cssObject


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

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

#assert_not_matches_xpathObject


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

#assert_selectObject


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

#assert_selectorObject


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

#assert_siblingObject


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

#assert_tableObject


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

#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 246

#assert_xpathObject


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

#refute_buttonObject

Assert that provided button does not exist


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

#refute_checked_fieldObject


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

#refute_cssObject

Assert that provided css does not exist


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

#refute_fieldObject

Assert that provided field does not exist


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


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

#refute_matches_cssObject

Assert that element matches css


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

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

#refute_selectObject

Assert that provided select does not exist


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

#refute_tableObject

Assert that provided table does not exist


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

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

#refute_xpathObject

Assert that provide xpath does not exist


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