Sha256: 0a5dcdf0e92ac6b69762fc7d39335321c7cbd67ab68a13079d3a6d9c48194463

Contents?: true

Size: 435 Bytes

Versions: 4

Compression:

Stored size: 435 Bytes

Contents

# encoding: UTF-8

require 'rspec/expectations'

RSpec::Matchers.define :respond_with do |*args|
	status = if Integer === args.first
		args.shift 
	else
		nil
	end
	headers = if Hash === args.last
		args.pop
	else
		{}
	end
	body = args.first
	
	match do |actual|
		(status ? actual.status == status : true) and
		(body ? actual.body == body : true) and
		headers.all? do |name, value|
			actual.headers[name] == value
		end
	end
	
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mojito-0.2.6 lib/mojito/utils/rspec.rb
mojito-0.2.5 lib/mojito/utils/rspec.rb
mojito-0.2.4 lib/mojito/utils/rspec.rb
mojito-0.2.3 lib/mojito/utils/rspec.rb