Sha256: 97452bcfc466fb9cb8ec6821ed1b22ca5d519bb5f21d2e0fc959e9cbd58dd71f
Contents?: true
Size: 963 Bytes
Versions: 1
Compression:
Stored size: 963 Bytes
Contents
# frozen_string_literal: true RSpec::Matchers.define :respond_a_collection_of_record do |options = {}| match do |actual| result = JSON.parse(actual.browser.last_response.body, symbolize_names: true) result = result[options[:root]] unless options[:root].nil? result.instance_of?(Array) end description do 'respond with a records collection (Array)' end failure_message do |actual| result = JSON.parse(actual.browser.last_response.body, symbolize_names: true) result = result[options[:root]] unless options[:oot].nil? "expected #{actual} response body would be a collection \nneed : Array, \ngot : #{result.class}" end failure_message_when_negated do |actual| result = JSON.parse(actual.browser.last_response.body, symbolize_names: true) result = result[options[:root]] unless options[:root].nil? "expected #{actual} response body would not be a collection \nneed : Array, \ngot : #{result.class}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-rest-rspec-1.0.0 | lib/rack-rest-rspec/matchers/respond_a_collection_of_record.rb |