Sha256: 193f346bdf2bbf27cb384476966af5a75eb74c349e1062c00caccf9c1378cbe2

Contents?: true

Size: 756 Bytes

Versions: 21

Compression:

Stored size: 756 Bytes

Contents

#!/usr/bin/ruby
# 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

21 entries across 21 versions & 1 rubygems

Version Path
mongrel2-0.52.2 spec/matchers.rb
mongrel2-0.52.1 spec/matchers.rb
mongrel2-0.52.0 spec/matchers.rb
mongrel2-0.51.0 spec/matchers.rb
mongrel2-0.50.2 spec/matchers.rb
mongrel2-0.50.1 spec/matchers.rb
mongrel2-0.50.0 spec/matchers.rb
mongrel2-0.49.0 spec/matchers.rb
mongrel2-0.48.0 spec/matchers.rb
mongrel2-0.47.0 spec/matchers.rb
mongrel2-0.46.0 spec/matchers.rb
mongrel2-0.45.1 spec/matchers.rb
mongrel2-0.45.0 spec/matchers.rb
mongrel2-0.44.0 spec/matchers.rb
mongrel2-0.43.2 spec/matchers.rb
mongrel2-0.43.0 spec/matchers.rb
mongrel2-0.42.0 spec/matchers.rb
mongrel2-0.42.0.pre.410 spec/matchers.rb
mongrel2-0.41.0 spec/matchers.rb
mongrel2-0.40.0 spec/matchers.rb