Sha256: 445ba5ceae47ecce33f83a1881a0edff64dce241119f5bbc3b64dd5fbe19570b

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

RSpec::Matchers.define :have_header do |expected|
  match do |actual|
    actual.has_css?('h1', text: expected)
  end

  failure_message do |actual|
    if actual.has_css?('h1')
      "expected that page has header #{expected.inspect}, but actual #{actual.find('h1').text.inspect}."
    else
      'expected that page has header. Can you confirm your page has `.h1`?'
    end
  end
end

RSpec::Matchers.define :have_notice do |expected|
  match do |actual|
    actual.has_css?('.notice', text: expected)
  end

  failure_message do |actual|
    if actual.has_css?('.notice')
      "expected that page has notice #{expected.inspect}, but actual #{actual.find('.notice').text.inspect}."
    else
      'expected that page has notice. Can you confirm your page has `.notice`?'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daimon-exhibition-0.1.0 spec/support/matchers.rb