Sha256: 5805a728c2ef472077c6c6a5a4bf68d2908cf86db6a69cca3484a21ff2b17cb6

Contents?: true

Size: 550 Bytes

Versions: 1

Compression:

Stored size: 550 Bytes

Contents

require "rspec"
require "wildcard_matchers"

RSpec.configure do |c|
  c.include WildcardMatchers
end

RSpec::Matchers.define :wildcard_match do |expected|
  match do |actual|
    @matcher = WildcardMatchers::WildcardMatcher.new(expected)
    @matcher === actual
  end

  failure_message_for_should do |actual|
    @matcher.errors.join("\n")
  end
end

module RSpec::Matchers
  alias wildcard_match_without_block wildcard_match
  def wildcard_match(expected = nil, &block)
    wildcard_match_without_block((block_given? ? block : expected))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wildcard_matchers-0.1.8 lib/wildcard_matchers/rspec.rb