Sha256: 2993d97dd5369c057e5c639664cca47ee327454f4453f84d08bc4495cb4d7690

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Adhearsion::Statistics::Dump do
  it "should have a timestamp" do
    origin_time = Time.now
    dump = Adhearsion::Statistics::Dump.new timestamp: origin_time
    expect(dump.timestamp).to eq(origin_time)
  end

  it "should have a hash of call counts" do
    counts = {dialed: 0, offered: 0, routed: 0, rejected: 0, active: 0}
    dump = Adhearsion::Statistics::Dump.new call_counts: counts
    expect(dump.call_counts).to eq(counts)
  end

  it "should have a hash of call counts by route" do
    counts = {"my route" => 1, "your route" => 10}
    dump = Adhearsion::Statistics::Dump.new calls_by_route: counts
    expect(dump.calls_by_route).to eq(counts)
  end

  it "should be equal to another dump if they share the same timestamp" do
    origin_time = Time.now
    dump1 = Adhearsion::Statistics::Dump.new timestamp: origin_time
    dump2 = Adhearsion::Statistics::Dump.new timestamp: origin_time
    expect(dump1).to eq(dump2)
  end

  it "should compare based on the timestamp" do
    origin_time = Time.now
    dump1 = Adhearsion::Statistics::Dump.new timestamp: origin_time
    dump2 = Adhearsion::Statistics::Dump.new timestamp: (origin_time + 1)
    expect(dump1).to be < dump2
    expect(dump2).to be > dump1
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adhearsion-2.6.4 spec/adhearsion/statistics/dump_spec.rb
adhearsion-2.6.3 spec/adhearsion/statistics/dump_spec.rb
adhearsion-3.0.0.rc1 spec/adhearsion/statistics/dump_spec.rb
adhearsion-3.0.0.beta2 spec/adhearsion/statistics/dump_spec.rb
adhearsion-3.0.0.beta1 spec/adhearsion/statistics/dump_spec.rb
adhearsion-2.6.2 spec/adhearsion/statistics/dump_spec.rb
adhearsion-2.6.1 spec/adhearsion/statistics/dump_spec.rb
adhearsion-2.6.0 spec/adhearsion/statistics/dump_spec.rb