Sha256: d539ff2890d84902a786e17b7502b6d100d464d299b2bb5e837a563c5c05fa5d

Contents?: true

Size: 746 Bytes

Versions: 3

Compression:

Stored size: 746 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'rubygems'
require 'bundler/setup'
require 'forgery'
require 'ipaddr'

ENV["TESTING_VIA_RSPEC"] = "true"

RSpec.configure do |config|

end

class OnlyContain
  def initialize(*expected)
    @expected = [expected].flatten
  end

  def matches?(target)
     @target = target.dup
     @expected.each do |e|
       target.gsub!(e, '')
     end
     target.size == 0
  end

  def failure_message
    "expected #{@target} to only contain #{@expected.join(', ')}"
  end

  def failure_message
    "expected #{@target} to not only contain #{@expected.join(', ')}"
  end
end

def only_contain(*expected)
  OnlyContain.new(expected)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
forgery-0.8.1 spec/spec_helper.rb
forgery-0.7.0 spec/spec_helper.rb
forgery-0.6.0 spec/spec_helper.rb