Sha256: e9508a4477287edfe0f8d6f1f4d2778ab9c5816bec31553e6f60a417aa0a06dd

Contents?: true

Size: 1.89 KB

Versions: 6

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'

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

      describe "from a stanza" do
        let :stanza do
          <<-MESSAGE
<complete xmlns='urn:xmpp:rayo:ext:1'>
  <success xmlns='urn:xmpp:tropo:say:complete:1' />
</complete>
          MESSAGE
        end

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

        it { should be_instance_of Complete }

        it_should_behave_like 'event'

        its(:reason) { should be_instance_of Component::Tropo::Say::Complete::Success }
      end
    end

    describe Complete::Stop do
      let :stanza do
        <<-MESSAGE
<complete xmlns='urn:xmpp:rayo:ext:1'>
  <stop xmlns='urn:xmpp:rayo:ext:complete:1' />
</complete>
        MESSAGE
      end

      subject { RayoNode.import(parse_stanza(stanza).root).reason }

      it { should be_instance_of Complete::Stop }

      its(:name) { should == :stop }
    end

    describe Complete::Hangup do
      let :stanza do
        <<-MESSAGE
<complete xmlns='urn:xmpp:rayo:ext:1'>
  <hangup xmlns='urn:xmpp:rayo:ext:complete:1' />
</complete>
        MESSAGE
      end

      subject { RayoNode.import(parse_stanza(stanza).root).reason }

      it { should be_instance_of Complete::Hangup }

      its(:name) { should == :hangup }
    end

    describe Complete::Error do
      let :stanza do
        <<-MESSAGE
<complete xmlns='urn:xmpp:rayo:ext:1'>
  <error xmlns='urn:xmpp:rayo:ext:complete:1'>
    Something really bad happened
  </error>
</complete>
        MESSAGE
      end

      subject { RayoNode.import(parse_stanza(stanza).root).reason }

      it { should be_instance_of Complete::Error }

      its(:name) { should == :error }
      its(:details) { should == "Something really bad happened" }
    end
  end
end # Punchblock

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
punchblock-0.5.1 spec/punchblock/event/complete_spec.rb
punchblock-0.5.0 spec/punchblock/event/complete_spec.rb
punchblock-0.4.3 spec/punchblock/event/complete_spec.rb
punchblock-0.4.2 spec/punchblock/event/complete_spec.rb
punchblock-0.4.1 spec/punchblock/event/complete_spec.rb
punchblock-0.4.0 spec/punchblock/event/complete_spec.rb