Sha256: b9f6b8ab4c4f919bc0e144dcb35e3ac5fe0bfa52fdfcbf7dffcd093523709c89
Contents?: true
Size: 669 Bytes
Versions: 1
Compression:
Stored size: 669 Bytes
Contents
# frozen_string_literal: true 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 { "expected document to #{name_to_sentence}#{expected_to_sentence}"} failure_message_when_negated { "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-4.0.0 | spec/support/have_node_matcher.rb |