class Capybara::RSpecMatchers::HaveText

Attributes

content[R]
options[R]
type[R]

Public Class Methods

new(*args) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 96
def initialize(*args)
  @args = args.dup

  # are set just for backwards compatability
  @type = args.shift if args.first.is_a?(Symbol)
  @content = args.shift
  @options = (args.first.is_a?(Hash))? args.first : {}
end

Public Instance Methods

description() click to toggle source
# File lib/capybara/rspec/matchers.rb, line 113
def description
  "text #{format(content)}"
end
does_not_match?(actual) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 109
def does_not_match?(actual)
  wrap_does_not_match?(actual) { |el| el.assert_no_text(*@args) }
end
format(content) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 117
def format(content)
  content = Capybara::Helpers.normalize_whitespace(content) unless content.is_a? Regexp
  content.inspect
end
matches?(actual) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 105
def matches?(actual)
  wrap_matches?(actual) { |el| el.assert_text(*@args) }
end