Class: Webrat::Matchers::HaveSelector
- Defined in:
- lib/webrat/core/matchers/have_selector.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#failure_message ⇒ Object
Returns String:: The failure message.
-
#negative_failure_message ⇒ Object
Returns String:: The failure message to be displayed in negative matches.
- #query ⇒ Object
- #tag_inspect ⇒ Object
Methods inherited from HaveXpath
#add_attributes_conditions_to, #add_content_condition_to, #add_options_conditions_to, #initialize, #matches, #matches?, #nokogiri_matches
Constructor Details
This class inherits a constructor from Webrat::Matchers::HaveXpath
Instance Method Details
#failure_message ⇒ Object
Returns
- String
-
The failure message.
9 10 11 |
# File 'lib/webrat/core/matchers/have_selector.rb', line 9 def "expected following output to contain a #{tag_inspect} tag:\n#{@document}" end |
#negative_failure_message ⇒ Object
Returns
- String
-
The failure message to be displayed in negative matches.
15 16 17 |
# File 'lib/webrat/core/matchers/have_selector.rb', line 15 def "expected following output to omit a #{tag_inspect}:\n#{@document}" end |
#query ⇒ Object
38 39 40 41 42 |
# File 'lib/webrat/core/matchers/have_selector.rb', line 38 def query Nokogiri::CSS.parse(@expected.to_s).map do |ast| ast.to_xpath end.first end |
#tag_inspect ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/webrat/core/matchers/have_selector.rb', line 19 def tag_inspect = @options.dup count = .delete(:count) content = .delete(:content) html = "<#{@expected}" .each do |k,v| html << " #{k}='#{v}'" end if content html << ">#{content}</#{@expected}>" else html << "/>" end html end |