Class: Capybara::RSpecMatchers::HaveTitle

Inherits:
Matcher
  • Object
show all
Defined in:
lib/capybara/rspec/matchers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Matcher

#wrap

Constructor Details

#initialize(title) ⇒ HaveTitle

Returns a new instance of HaveTitle.



77
78
79
# File 'lib/capybara/rspec/matchers.rb', line 77

def initialize(title)
  @title = title
end

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.



75
76
77
# File 'lib/capybara/rspec/matchers.rb', line 75

def title
  @title
end

Instance Method Details

#descriptionObject



99
100
101
# File 'lib/capybara/rspec/matchers.rb', line 99

def description
  "have title #{title.inspect}"
end

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
89
# File 'lib/capybara/rspec/matchers.rb', line 86

def does_not_match?(actual)
  @actual = wrap(actual)
  @actual.has_no_title?(title)
end

#failure_message_for_shouldObject



91
92
93
# File 'lib/capybara/rspec/matchers.rb', line 91

def failure_message_for_should
  "expected there to be title #{title.inspect} in #{@actual.title.inspect}"
end

#failure_message_for_should_notObject



95
96
97
# File 'lib/capybara/rspec/matchers.rb', line 95

def failure_message_for_should_not
  "expected there not to be title #{title.inspect} in #{@actual.title.inspect}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
84
# File 'lib/capybara/rspec/matchers.rb', line 81

def matches?(actual)
  @actual = wrap(actual)
  @actual.has_title?(title)
end