mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-19 07:26:03 +01:00
15 lines
363 B
Ruby
15 lines
363 B
Ruby
# frozen_string_literal: true
|
|
|
|
module NokogiriMatchers
|
|
RSpec::Matchers.matcher :have_css do |css|
|
|
description { %(have at least one element matching the CSS selector #{css.inspect}) }
|
|
|
|
match do |rendered|
|
|
Nokogiri::HTML.parse(rendered).css(css).size.positive?
|
|
end
|
|
end
|
|
end
|
|
|
|
RSpec.configure do |c|
|
|
c.include NokogiriMatchers, view: true
|
|
end
|