Sha256: df55279d5927bd6cdab85978827d29bd26d7e663063643878a061cae71bba12b

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

# frozen_string_literal: true

RSpec::Matchers.define :have_meta do |name, expected|
  match do |_actual|
    has_css?("meta[name='#{name}'][content='#{expected}']", visible: false)
  end

  failure_message do |_actual|
    actual = first("meta[name='#{name}']")

    if actual
      "expected that meta #{name} would have content='#{expected}' " \
      "but was '#{actual[:content]}'"
    else
      "expected that meta #{name} would exist with content='#{expected}'"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/support/matchers/have_meta.rb
archangel-0.3.0 lib/archangel/testing_support/matchers/have_meta.rb