Sha256: 8a82ab7c35333f6ce1d800a57dc3aecf3b30c5e2a2af158bb52eed858897bd14
Contents?: true
Size: 773 Bytes
Versions: 11
Compression:
Stored size: 773 Bytes
Contents
require 'rspec/expectations' RSpec::Matchers.define :be_a_json_object do @properties = [] match do |object| expect(object).to have_key 'type' expect(object).to have_key 'properties' expect(object['type']).to eq 'object' if @properties.present? @properties.each do |property| expect(object['properties']).to have_key property end end true end chain :with_properties do |*properties| @properties |= properties end chain :with_property do |property| @properties << property end failure_message_for_should do |object| "expected that #{object.try(:to_hash) || object} to be a json object".tap do |message| message << " with properties #{@properties}" if @properties.present? end end end
Version data entries
11 entries across 11 versions & 1 rubygems