Sha256: 6b9663c08a7ba20a1b10b94c7e30f1eed1adbb897edfcd86841ea93ceba6eaad

Contents?: true

Size: 443 Bytes

Versions: 5

Compression:

Stored size: 443 Bytes

Contents

RSpec::Matchers.define :have_css do |expected, times|
  match do |actual|
    HTML::Selector.new(expected).select(actual).should have_at_least(times || 1).entry
  end

  failure_message_for_should do |actual|
    "expected #{actual.to_s} to have #{times || 1} elements matching '#{expected}'"
  end

  failure_message_for_should_not do |actual|
    "expected #{actual.to_s} not to have #{times || 1} elements matching '#{expected}'"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple-navigation-3.14.0 spec/initializers/have_css_matcher.rb
simple-navigation-3.13.0 spec/initializers/have_css_matcher.rb
simple-navigation-3.12.2 spec/initializers/have_css_matcher.rb
simple-navigation-3.12.1 spec/initializers/have_css_matcher.rb
simple-navigation-3.12.0 spec/initializers/have_css_matcher.rb