Sha256: 528cdfa3f06dd1da319d482908112a92a59f8734596cd4c121187204d6a36e0a

Contents?: true

Size: 785 Bytes

Versions: 3

Compression:

Stored size: 785 Bytes

Contents

# -*- ruby -*-
# frozen_string_literal: true
# coding: utf-8

require 'mongrel2' unless defined?( Mongrel2 )


### RSpec matchers for Mongrel2 specs
module Mongrel2::Matchers # :nodoc:

    ### A matcher for unordered array contents
	class EnumerableAllBeMatcher

		def initialize( expected_mod )
			@expected_mod = expected_mod
		end

		def matches?( collection )
			collection.all? {|obj| obj.is_a?(@expected_mod) }
		end

		def description
			return "all be a kind of %p" % [ @expected_mod ]
		end
	end


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

	### Returns true if the actual value is an Array, all of which respond truly to
	### .is_a?( expected_mod )
	def all_be_a( expected_mod )
		EnumerableAllBeMatcher.new( expected_mod )
	end


end # module Mongrel2::Matchers


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongrel2-0.55.0 spec/matchers.rb
mongrel2-0.54.0 spec/matchers.rb
mongrel2-0.53.0 spec/matchers.rb