Class: Capybara::RSpecMatchers::HaveSelector
- Inherits:
-
Object
- Object
- Capybara::RSpecMatchers::HaveSelector
- Defined in:
- lib/capybara/rspec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actual) ⇒ Boolean
-
#initialize(*args) ⇒ HaveSelector
constructor
A new instance of HaveSelector.
- #matches?(actual) ⇒ Boolean
- #query ⇒ Object
- #wrap(actual) ⇒ Object
Constructor Details
#initialize(*args) ⇒ HaveSelector
Returns a new instance of HaveSelector.
4 5 6 |
# File 'lib/capybara/rspec/matchers.rb', line 4 def initialize(*args) @args = args end |
Instance Method Details
#description ⇒ Object
16 17 18 |
# File 'lib/capybara/rspec/matchers.rb', line 16 def description "have #{query.description}" end |
#does_not_match?(actual) ⇒ Boolean
12 13 14 |
# File 'lib/capybara/rspec/matchers.rb', line 12 def does_not_match?(actual) wrap(actual).assert_no_selector(*@args) end |
#matches?(actual) ⇒ Boolean
8 9 10 |
# File 'lib/capybara/rspec/matchers.rb', line 8 def matches?(actual) wrap(actual).assert_selector(*@args) end |
#query ⇒ Object
28 29 30 |
# File 'lib/capybara/rspec/matchers.rb', line 28 def query @query ||= ::Query.new(*@args) end |
#wrap(actual) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/capybara/rspec/matchers.rb', line 20 def wrap(actual) if actual.respond_to?("has_selector?") actual else .string(actual.to_s) end end |