Sha256: 1e7dd1a6bcf0e6289d28e8be8ca3f3c84e0aefe61c8b53386ce851696b04eaf2

Contents?: true

Size: 930 Bytes

Versions: 3

Compression:

Stored size: 930 Bytes

Contents

#!/usr/bin/ruby
# coding: utf-8

BEGIN {
	require 'pathname'
	basedir = Pathname.new( __FILE__ ).dirname.parent

	libdir = basedir + "lib"

	$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
}

require 'rspec'

require 'yaml'
require 'treequel'

require 'spec/lib/constants'

### RSpec matchers
module Treequel::Matchers

	class ArrayIncludingMatcher
		def initialize( expected )
			@expected = expected
		end

		def ==( actual )
			@expected.each do |value|
				return false unless actual.include?( value )
			end
			true
		rescue NoMethodError => ex
			return false
		end

		def description
			"array_including(#{ @expected.inspect.sub(/^\[|\]$/,"") })"
		end
	end


	###############
	module_function
	###############

	### Return true if the actual value includes the specified +objects+.
	def array_including( *objects )
		ArrayIncludingMatcher.new( objects )
	end


end # module Treequel::Matchers

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
treequel-1.2.1 spec/lib/matchers.rb
treequel-1.2.0 spec/lib/matchers.rb
treequel-1.2.0pre320 spec/lib/matchers.rb