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

Version Path
kurchatov-0.4.7 tests/testreceived.rb
kurchatov-0.4.6 tests/testreceived.rb
kurchatov-0.4.5 tests/testreceived.rb
kurchatov-0.4.4 tests/testreceived.rb
kurchatov-0.4.3 tests/testreceived.rb
kurchatov-0.4.2 tests/testreceived.rb
kurchatov-0.4.1 tests/testreceived.rb
kurchatov-0.3.8 tests/testreceived.rb
kurchatov-0.3.7 tests/testreceived.rb
kurchatov-0.3.6 tests/testreceived.rb
kurchatov-0.3.5 tests/testreceived.rb
kurchatov-0.3.4 tests/testreceived.rb
kurchatov-0.3.3 tests/testreceived.rb
kurchatov-0.3.2 tests/testreceived.rb
kurchatov-0.3.1 tests/testreceived.rb
kurchatov-0.3.0 tests/testreceived.rb
kurchatov-0.2.9 tests/testreceived.rb
kurchatov-0.2.8 tests/testreceived.rb
kurchatov-0.2.7 tests/testreceived.rb
kurchatov-0.2.6 tests/testreceived.rb