spec/adhearsion/statistics_spec.rb in adhearsion-2.6.4 vs spec/adhearsion/statistics_spec.rb in adhearsion-3.0.0.beta1

- old
+ new

@@ -1,18 +1,15 @@ # encoding: utf-8 require 'spec_helper' describe Adhearsion::Statistics do - before(:all) do - Adhearsion::Statistics.setup_event_handlers - end - subject { Celluloid::Actor[:statistics] } before do Celluloid::Actor[:statistics] = described_class.new + Adhearsion::Statistics.setup_event_handlers allow(Adhearsion.active_calls).to receive_messages count: 0 end after do Celluloid::Actor.clear_registry @@ -36,10 +33,10 @@ Adhearsion::Events.trigger_immediately :call_dialed, :foo_call expect(subject.dump.call_counts).to eq({dialed: 1, offered: 0, routed: 0, rejected: 0, active: 0}) end it "should listen for call offer events and increment the offered call count" do - Adhearsion::Events.trigger_immediately :punchblock, Punchblock::Event::Offer.new + Adhearsion::Events.trigger_immediately :rayo, Adhearsion::Event::Offer.new expect(subject.dump.call_counts).to eq({dialed: 0, offered: 1, routed: 0, rejected: 0, active: 0}) end context "when call_routed events are triggered" do let(:route) { Adhearsion::Router::Route.new('my route') }