Class: Minitest::Capybara::Unit::Matcher::MatcherName
- Inherits:
-
Object
- Object
- Minitest::Capybara::Unit::Matcher::MatcherName
- Defined in:
- lib/minitest-capybara-unit.rb
Instance Attribute Summary collapse
-
#original ⇒ Object
readonly
Returns the value of attribute original.
-
#positive ⇒ Object
readonly
Returns the value of attribute positive.
Instance Method Summary collapse
- #assertion ⇒ Object
-
#initialize(name) ⇒ MatcherName
constructor
A new instance of MatcherName.
- #negate! ⇒ Object
- #positive? ⇒ Boolean
- #without_question_mark ⇒ Object
Constructor Details
#initialize(name) ⇒ MatcherName
Returns a new instance of MatcherName.
63 64 65 66 |
# File 'lib/minitest-capybara-unit.rb', line 63 def initialize(name) @original = name @positive = true end |
Instance Attribute Details
#original ⇒ Object (readonly)
Returns the value of attribute original.
61 62 63 |
# File 'lib/minitest-capybara-unit.rb', line 61 def original @original end |
#positive ⇒ Object (readonly)
Returns the value of attribute positive.
61 62 63 |
# File 'lib/minitest-capybara-unit.rb', line 61 def positive @positive end |
Instance Method Details
#assertion ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/minitest-capybara-unit.rb', line 80 def assertion if positive? "assert_page_#{without_question_mark}" else "refute_page_#{without_question_mark}" end end |
#negate! ⇒ Object
72 73 74 |
# File 'lib/minitest-capybara-unit.rb', line 72 def negate! @positive = !positive end |
#positive? ⇒ Boolean
68 69 70 |
# File 'lib/minitest-capybara-unit.rb', line 68 def positive? !!positive end |
#without_question_mark ⇒ Object
76 77 78 |
# File 'lib/minitest-capybara-unit.rb', line 76 def without_question_mark original.to_s.sub(/\?$/, '') end |