Class: Capybara::RSpecMatchers::HaveTitle

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

Instance Attribute Summary collapse

Attributes inherited from Matcher

#failure_message, #failure_message_when_negated

Instance Method Summary collapse

Methods inherited from Matcher

#wrap

Methods included from Compound

#and, #and_then, #or

Constructor Details

#initialize(*args) ⇒ HaveTitle

Returns a new instance of HaveTitle



170
171
172
173
174
175
# File 'lib/capybara/rspec/matchers.rb', line 170

def initialize(*args)
  @args = args

  # are set just for backwards compatability
  @title = args.first
end

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title



168
169
170
# File 'lib/capybara/rspec/matchers.rb', line 168

def title
  @title
end

Instance Method Details

#descriptionObject



185
186
187
# File 'lib/capybara/rspec/matchers.rb', line 185

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

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


181
182
183
# File 'lib/capybara/rspec/matchers.rb', line 181

def does_not_match?(actual)
  wrap_does_not_match?(actual) { |el| el.assert_no_title(*@args) }
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


177
178
179
# File 'lib/capybara/rspec/matchers.rb', line 177

def matches?(actual)
  wrap_matches?(actual) { |el| el.assert_title(*@args) }
end