Sha256: 669b604c34bfbe3b975c20bbb2c3cb1a4a977fce520972feb445175353db94a1
Contents?: true
Size: 1.17 KB
Versions: 6
Compression:
Stored size: 1.17 KB
Contents
require 'fitting/report/response' module Fitting module Report class Responses def initialize(responses) @responses = responses @responses = [] responses.to_a.map do |response| @responses.push(Fitting::Report::Response.new(response)) end end def to_a @responses end def join(tests) tests.to_a.map do |test| if is_there_a_suitable_response?(test) cram_into_the_appropriate_response(test) test.mark_response end end end def is_there_a_suitable_response?(test) return false if @responses.nil? @responses.map do |response| return true if response.status.to_s == test.status && JSON::Validator.fully_validate(response.body, test.body) == [] end false end def cram_into_the_appropriate_response(test) @responses.map do |response| if response.status.to_s == test.status && JSON::Validator.fully_validate(response.body, test.body) == [] response.add_test(test) return end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems