Sha256: 2e784cee54709d101736f65a77c677402da9ab3984a8d33de39274855cc27ce9

Contents?: true

Size: 755 Bytes

Versions: 2

Compression:

Stored size: 755 Bytes

Contents

RSpec::Matchers.define :be_in do |expected|
  match do |actual|
    expected === actual
  end

  failure_message_for_should do |actual|
    "expected that #{actual} would be in #{expected}"
  end
end

RSpec::Matchers.define :be_number do
  match do |actual|
    actual.is_a?(Numeric) && actual.send(@symbol, @expected)
  end

  chain :>= do |expected|
    @symbol = :>=
    @expected = expected
  end

  chain :> do |expected|
    @symbol = :>
    @expected = expected
  end

  chain :< do |expected|
    @symbol = :<
    @expected = expected
  end

  chain :<= do |expected|
    @symbol = :<=
    @expected = expected
  end

  failure_message do |actual|
    "expected that #{actual.inspect} would be a number and #{@symbol} than #{@expected}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
PageRankr-4.6.1 spec/support/custom_matchers.rb
PageRankr-4.6.0 spec/support/custom_matchers.rb