Sha256: 32202c81e4401bf1c1a278a44bd69f0f6f1962d9aa7ab9f5a0b437e161b531a3

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

%w{
  blather/client/dsl
  punchblock/core_ext/blather/stanza
  punchblock/core_ext/blather/stanza/presence
}.each { |f| require f }

module Punchblock
  module Command
    describe Dial do

      it 'registers itself' do
        RayoNode.class_from_registration(:dial, 'urn:xmpp:rayo:1').should == Dial
      end

      describe "when setting options in initializer" do
        let(:join_params) { {:other_call_id => 'abc123'} }

        subject { Dial.new :to => 'tel:+14155551212', :from => 'tel:+13035551212', :headers => { :x_skill => 'agent', :x_customer_id => 8877 }, :join => join_params }

        it_should_behave_like 'command_headers'

        its(:to)    { should == 'tel:+14155551212' }
        its(:from)  { should == 'tel:+13035551212' }
        its(:join)  { should == Join.new(join_params) }
      end

      describe "#response=" do
        before { subject.request! }

        let(:call_id) { 'abc123' }

        let :ref do
          Ref.new.tap do |ref|
            ref.id = call_id
          end
        end

        let :iq do
          Blather::Stanza::Iq.new(:result, 'blah').tap do |iq|
            iq.from = "call.rayo.net"
            iq << ref
          end
        end

        it "should set the call ID from the ref" do
          subject.response = iq
          subject.call_id.should == call_id
        end
      end
    end
  end
end # Punchblock

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
punchblock-0.4.3 spec/punchblock/command/dial_spec.rb
punchblock-0.4.2 spec/punchblock/command/dial_spec.rb
punchblock-0.4.1 spec/punchblock/command/dial_spec.rb
punchblock-0.4.0 spec/punchblock/command/dial_spec.rb