Sha256: 2e5ca1c8170e785e2dc81033d422a6cd348729ddc3f98d31a0660e3b39325fdf
Contents?: true
Size: 694 Bytes
Versions: 3
Compression:
Stored size: 694 Bytes
Contents
RSpec::Matchers.define :have_rule do |expected| match do |actual| @rules = rules_from_selector(actual) @rules.include? expected end failure_message do |actual| if @rules.empty? %{no CSS rules for selector #{actual} were found} else %{expected selector #{actual} to have CSS rule "#{expected}"} end end def rules_from_selector(selector) rulesets = ParserSupport.parser.find_by_selector(selector) if rulesets.empty? [] else rules(rulesets) end end def rules(rulesets) rules = [] rulesets.map do |ruleset| ruleset.split(';').each do |rule| rules << rule.strip end end rules end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neat-1.7.0 | spec/support/matchers/have_rule.rb |
neat-1.7.0.rc | spec/support/matchers/have_rule.rb |
neat-1.7.0.pre | spec/support/matchers/have_rule.rb |