Parent

Capybara::RSpecMatchers::HaveText

Attributes

text[R]

Public Class Methods

new(text) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 36
def initialize(text)
  @text = text
end

Public Instance Methods

description() click to toggle source
# File lib/capybara/rspec/matchers.rb, line 58
def description
  "have text #{format(text)}"
end
does_not_match?(actual) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 45
def does_not_match?(actual)
  @actual = wrap(actual)
  @actual.has_no_text?(text)
end
failure_message_for_should() click to toggle source
# File lib/capybara/rspec/matchers.rb, line 50
def failure_message_for_should
  "expected there to be text #{format(text)} in #{format(@actual.text)}"
end
failure_message_for_should_not() click to toggle source
# File lib/capybara/rspec/matchers.rb, line 54
def failure_message_for_should_not
  "expected there not to be text #{format(text)} in #{format(@actual.text)}"
end
format(text) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 70
def format(text)
  text = Capybara::Helpers.normalize_whitespace(text) unless text.is_a? Regexp
  text.inspect
end
matches?(actual) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 40
def matches?(actual)
  @actual = wrap(actual)
  @actual.has_text?(text)
end
wrap(actual) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 62
def wrap(actual)
  if actual.respond_to?("has_selector?")
    actual
  else
    Capybara.string(actual.to_s)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.