Sha256: 91afd1e280ca00849ee59e4b73305e93ec4ed001193d1c56ecea98ee5ce21cdd

Contents?: true

Size: 1.3 KB

Versions: 14

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

module Punchblock
  class Event
    describe Offer do
      it 'registers itself' do
        RayoNode.class_from_registration(:offer, 'urn:xmpp:rayo:1').should == Offer
      end

      describe "from a stanza" do
        let :stanza do
          <<-MESSAGE
<offer xmlns='urn:xmpp:rayo:1'
    to='tel:+18003211212'
    from='tel:+13058881212'>
  <!-- Signaling (e.g. SIP) Headers -->
  <header name="x-skill" value="agent" />
  <header name="x-customer-id" value="8877" />
</offer>
          MESSAGE
        end

        subject { RayoNode.import parse_stanza(stanza).root, '9f00061', '1' }

        it { should be_instance_of Offer }

        it_should_behave_like 'event'
        it_should_behave_like 'event_headers'

        its(:to)    { should == 'tel:+18003211212' }
        its(:from)  { should == 'tel:+13058881212' }
      end

      describe "when setting options in initializer" do
        subject do
          Offer.new :to       => 'tel:+18003211212',
                    :from     => 'tel:+13058881212',
                    :headers  => { :x_skill => "agent", :x_customer_id => "8877" }
        end

        it_should_behave_like 'event_headers'

        its(:to)    { should == 'tel:+18003211212' }
        its(:from)  { should == 'tel:+13058881212' }
      end
    end
  end
end # Punchblock

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
punchblock-0.9.2 spec/punchblock/event/offer_spec.rb
punchblock-0.9.1 spec/punchblock/event/offer_spec.rb
punchblock-0.9.0 spec/punchblock/event/offer_spec.rb
punchblock-0.8.4 spec/punchblock/event/offer_spec.rb
punchblock-0.8.3 spec/punchblock/event/offer_spec.rb
punchblock-0.8.2 spec/punchblock/event/offer_spec.rb
punchblock-0.8.1 spec/punchblock/event/offer_spec.rb
punchblock-0.8.0 spec/punchblock/event/offer_spec.rb
punchblock-0.7.2 spec/punchblock/event/offer_spec.rb
punchblock-0.7.1 spec/punchblock/event/offer_spec.rb
punchblock-0.7.0 spec/punchblock/event/offer_spec.rb
punchblock-0.6.2 spec/punchblock/event/offer_spec.rb
punchblock-0.6.1 spec/punchblock/event/offer_spec.rb
punchblock-0.6.0 spec/punchblock/event/offer_spec.rb