Sha256: 78841796bf980efddc3d122ce050754b6da33968d6503238afa1da0be6fb92c5
Contents?: true
Size: 887 Bytes
Versions: 21
Compression:
Stored size: 887 Bytes
Contents
class TestReceived def initialize(events, file) @events = events @file = file end def data @data ||= YAML.load_file(@file) end def compare! @events.each do |e| data["events"].each do |d| next unless d[:service] == e[:service] next if d[:result] == e[:state] next if d[:time] && d[:time] != e[:time] raise "Recieved state: #{e[:state].inspect}, data state: #{d[:result].inspect}. \n Data: #{d.inspect} \n Event: #{e.inspect}" end end from_data = data["events"].select {|x| x[:miss_count] != true }.count from_events = @events.count raise "Not all events recieved: from data: #{from_data} and from server: #{from_events}" unless from_data == from_events puts "Recieved events:" puts "#{@events.inspect}" puts "Sample data:" puts "#{data.inspect}" puts "All done!" end end
Version data entries
21 entries across 21 versions & 1 rubygems