Sha256: 334d4c0b6f7cbfcfbdcc21416099fa9fe06d81fcb694a27c90694235d479a473
Contents?: true
Size: 670 Bytes
Versions: 6
Compression:
Stored size: 670 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.present? and match_attributes(node.attributes) else node.present? 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
6 entries across 6 versions & 2 rubygems