Class: Minitest::Capybara::Unit::Matcher
- Inherits:
-
Object
- Object
- Minitest::Capybara::Unit::Matcher
- Defined in:
- lib/minitest-capybara-unit.rb
Defined Under Namespace
Classes: MatcherName
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #define_assert ⇒ Object
- #define_refute ⇒ Object
-
#initialize(node_matcher_name) ⇒ Matcher
constructor
A new instance of Matcher.
- #test(page, *args) ⇒ Object
Constructor Details
#initialize(node_matcher_name) ⇒ Matcher
Returns a new instance of Matcher.
10 11 12 13 14 |
# File 'lib/minitest-capybara-unit.rb', line 10 def initialize(node_matcher_name) @name = MatcherName.new(node_matcher_name) define_assert define_refute end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/minitest-capybara-unit.rb', line 8 def name @name end |
Class Method Details
.failure_message(assertion_method, matcher_name, *args) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/minitest-capybara-unit.rb', line 29 def self.(assertion_method, matcher_name, *args) if assertion_method == 'assert' = "Matcher failed: " else = 'Matcher should have failed: ' end += "#{matcher_name}(#{args.map(&:inspect).join(', ')})" end |
Instance Method Details
#define_assert ⇒ Object
16 17 18 |
# File 'lib/minitest-capybara-unit.rb', line 16 def define_assert define_assertion end |
#define_refute ⇒ Object
20 21 22 23 |
# File 'lib/minitest-capybara-unit.rb', line 20 def define_refute name.negate! define_assertion end |
#test(page, *args) ⇒ Object
25 26 27 |
# File 'lib/minitest-capybara-unit.rb', line 25 def test(page, *args) wrap(page).send(name.original, *args) end |