Class: Dommy::Rails::RSpec::Matchers::HaveTitle
- Inherits:
-
Object
- Object
- Dommy::Rails::RSpec::Matchers::HaveTitle
- Defined in:
- lib/dommy/rails/rspec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actual) ⇒ Boolean
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected) ⇒ HaveTitle
constructor
A new instance of HaveTitle.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ HaveTitle
Returns a new instance of HaveTitle.
192 193 194 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 192 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
205 206 207 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 205 def description "have title #{@expected.inspect}" end |
#does_not_match?(actual) ⇒ Boolean
201 202 203 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 201 def does_not_match?(actual) !matches?(actual) end |
#failure_message ⇒ Object
209 210 211 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 209 def "expected title to match #{@expected.inspect}, got #{@document.title.inspect}" end |
#failure_message_when_negated ⇒ Object
213 214 215 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 213 def "expected title not to match #{@expected.inspect}" end |
#matches?(actual) ⇒ Boolean
196 197 198 199 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 196 def matches?(actual) @document = MatchTarget.document(actual) Dommy::Rails::PageInspector.title_matches?(@document, @expected) end |