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.
97 98 99 100 101 102 |
# File 'lib/capybara/rspec/matchers.rb', line 97 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.
95 96 97 |
# File 'lib/capybara/rspec/matchers.rb', line 95 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.
95 96 97 |
# File 'lib/capybara/rspec/matchers.rb', line 95 def @failure_message_when_negated end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
93 94 95 |
# File 'lib/capybara/rspec/matchers.rb', line 93 def title @title end |
Instance Method Details
#description ⇒ Object
118 119 120 |
# File 'lib/capybara/rspec/matchers.rb', line 118 def description "have title #{title.inspect}" end |
#does_not_match?(actual) ⇒ Boolean
111 112 113 114 115 116 |
# File 'lib/capybara/rspec/matchers.rb', line 111 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
104 105 106 107 108 109 |
# File 'lib/capybara/rspec/matchers.rb', line 104 def matches?(actual) wrap(actual).assert_title(*@args) rescue Capybara::ExpectationNotMet => e @failure_message = e. return false end |