Class: Capybara::RSpecMatchers::HaveTitle
- Defined in:
- lib/capybara/rspec/matchers.rb
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
(also: #failure_message_for_should)
readonly
Returns the value of attribute failure_message.
-
#failure_message_when_negated ⇒ Object
(also: #failure_message_for_should_not)
readonly
Returns the value of attribute failure_message_when_negated.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actual) ⇒ Boolean
-
#initialize(*args) ⇒ HaveTitle
constructor
A new instance of HaveTitle.
- #matches?(actual) ⇒ Boolean
Methods inherited from Matcher
Constructor Details
#initialize(*args) ⇒ HaveTitle
Returns a new instance of HaveTitle.
96 97 98 99 100 101 |
# File 'lib/capybara/rspec/matchers.rb', line 96 def initialize(*args) @args = args # are set just for backwards compatability @title = args.first end |
Instance Attribute Details
#failure_message ⇒ Object (readonly) Also known as: failure_message_for_should
Returns the value of attribute failure_message.
94 95 96 |
# File 'lib/capybara/rspec/matchers.rb', line 94 def @failure_message end |
#failure_message_when_negated ⇒ Object (readonly) Also known as: failure_message_for_should_not
Returns the value of attribute failure_message_when_negated.
94 95 96 |
# File 'lib/capybara/rspec/matchers.rb', line 94 def @failure_message_when_negated end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
92 93 94 |
# File 'lib/capybara/rspec/matchers.rb', line 92 def title @title end |
Instance Method Details
#description ⇒ Object
117 118 119 |
# File 'lib/capybara/rspec/matchers.rb', line 117 def description "have title #{title.inspect}" end |
#does_not_match?(actual) ⇒ Boolean
110 111 112 113 114 115 |
# File 'lib/capybara/rspec/matchers.rb', line 110 def does_not_match?(actual) wrap(actual).assert_no_title(*@args) rescue Capybara::ExpectationNotMet => e @failure_message_when_negated = e. return false end |
#matches?(actual) ⇒ Boolean
103 104 105 106 107 108 |
# File 'lib/capybara/rspec/matchers.rb', line 103 def matches?(actual) wrap(actual).assert_title(*@args) rescue Capybara::ExpectationNotMet => e @failure_message = e. return false end |