Class: Capybara::RSpecMatchers::HaveText
- Inherits:
-
Matcher
- Object
- Matcher
- Capybara::RSpecMatchers::HaveText
show all
- Defined in:
- lib/capybara/rspec/matchers.rb
Instance Attribute Summary
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) ⇒ HaveText
Returns a new instance of HaveText.
139
140
141
142
|
# File 'lib/capybara/rspec/matchers.rb', line 139
def initialize(*args)
@args = args.dup
@content = args[0].is_a?(Symbol) ? args[1] : args[0]
end
|
Instance Method Details
#description ⇒ Object
152
153
154
|
# File 'lib/capybara/rspec/matchers.rb', line 152
def description
"text #{format(@content)}"
end
|
#does_not_match?(actual) ⇒ Boolean
148
149
150
|
# File 'lib/capybara/rspec/matchers.rb', line 148
def does_not_match?(actual)
wrap_does_not_match?(actual) { |el| el.assert_no_text(*@args) }
end
|
156
157
158
|
# File 'lib/capybara/rspec/matchers.rb', line 156
def format(content)
content.inspect
end
|
#matches?(actual) ⇒ Boolean
144
145
146
|
# File 'lib/capybara/rspec/matchers.rb', line 144
def matches?(actual)
wrap_matches?(actual) { |el| el.assert_text(*@args) }
end
|