Sha256: 1d8e6fa03798aea0d2f4453e86e5dd99efcd4113869b0af5d143cc62817c4b8c
Contents?: true
Size: 651 Bytes
Versions: 1
Compression:
Stored size: 651 Bytes
Contents
RSpec::Matchers.define :have_node do |selector| chain(:with_attributes) { |attributes| @attributes = attributes } match do |document| node = document.at_css(selector) if @attributes node && match_attributes(node.attributes) else node end end failure_message_for_should { "expected document to #{name_to_sentence}#{expected_to_sentence}"} failure_message_for_should_not { "expected document to not #{name_to_sentence}#{expected_to_sentence}"} def match_attributes(node_attributes) attributes = Hash[node_attributes.map { |name, attribute| [name, attribute.value] }] @attributes == attributes end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
roadie-3.0.0.pre1 | spec/support/have_node_matcher.rb |