Sha256: 77fe498b7291cf58b4167760c09a43e8060b7f36303230a43d2b3f8ce62665dd
Contents?: true
Size: 760 Bytes
Versions: 6
Compression:
Stored size: 760 Bytes
Contents
RSpec::Matchers.define :have_styling do |rules| @selector = 'body > *:first' chain :at_selector do |selector| @selector = selector end match do |document| if rules.nil? parsed_styles(document).blank? else rules.to_a.should == parsed_styles(document) end end description { "have styles #{rules.inspect} at selector #{@selector.inspect}" } failure_message_for_should { |document| "expected styles at #{@selector.inspect} to be #{rules.inspect} but was #{parsed_styles(document).inspect}" } failure_message_for_should_not { "expected styles at #{@selector.inspect} to not be #{rules.inspect}" } def parsed_styles(document) node = document.css(@selector).first SpecHelpers.styling_of_node(node) end end
Version data entries
6 entries across 6 versions & 2 rubygems