Sha256: 0ec7099e29886278953b70fde8f5f5775393f197a7785fd5b39ad2619933bc39
Contents?: true
Size: 888 Bytes
Versions: 4
Compression:
Stored size: 888 Bytes
Contents
require 'rspec/expectations' RSpec::Matchers.define :have_class do |expected_| match do |actual| actual.match(/class\=(?:"|').*(#{expected}).*(?:"|')/) $1.present? end description do "have CSS class \"#{expected}\"" end failure_message do |actual| "expected #{actual} to have CSS class \"#{expected}\"" end failure_message_when_negated do |actual| "expected #{actual} not to have CSS class \"#{expected}\"" end end RSpec::Matchers.define :have_id do |expected_| match do |actual| actual.match(/id\=(?:"|')(#{expected})(?:"|')/) $1.present? end description do "have CSS id \"#{expected}\"" end failure_message do |actual| "expected #{actual} to have CSS id \"#{expected}\"" end failure_message_when_negated do |actual| "expected #{actual} not to have CSS id \"#{expected}\"" end end
Version data entries
4 entries across 4 versions & 1 rubygems