spec/adhearsion/punchblock_plugin/initializer_spec.rb in adhearsion-2.2.1 vs spec/adhearsion/punchblock_plugin/initializer_spec.rb in adhearsion-2.3.0
- old
+ new
@@ -52,11 +52,11 @@
flexmock Adhearsion::Process, :fqdn => 'hostname'
flexmock ::Process, :pid => 1234
end
let(:call_id) { rand }
- let(:offer) { Punchblock::Event::Offer.new.tap { |o| o.target_call_id = call_id } }
+ let(:offer) { Punchblock::Event::Offer.new :target_call_id => call_id }
let(:mock_call) { flexmock Call.new, :id => call_id }
describe "starts the client with the default values" do
subject { initialize_punchblock }
@@ -222,17 +222,19 @@
it 'should reject a call with cause :declined' do
mock_call.should_receive(:reject).once.with(:decline)
end
end
- context "when when Adhearsion::Process is in :running" do
- let(:process_state) { :running }
+ [ :running, :stopping ].each do |state|
+ context "when when Adhearsion::Process is in :#{state}" do
+ let(:process_state) { state }
- it "should dispatch via the router" do
- Adhearsion.router do
- route 'foobar', Class.new
+ it "should dispatch via the router" do
+ Adhearsion.router do
+ route 'foobar', Class.new
+ end
+ flexmock(Adhearsion.router).should_receive(:handle).once.with mock_call
end
- flexmock(Adhearsion.router).should_receive(:handle).once.with mock_call
end
end
context "when when Adhearsion::Process is in :rejecting" do
let(:process_state) { :rejecting }