Sha256: 33830db654910ede160c81a641b27bae3532f2bfaa3ec56804621ed55f0c00ee

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module Punchblock
  module Command
    describe Reject do
      it 'registers itself' do
        RayoNode.class_from_registration(:reject, 'urn:xmpp:rayo:1').should == Reject
      end

      describe "when setting options in initializer" do
        subject { Reject.new :reason => :busy, :headers => { :x_skill => 'agent', :x_customer_id => 8877 } }

        it_should_behave_like 'command_headers'

        its(:reason) { should == :busy }
      end

      describe "with the reason" do
        [:decline, :busy, :error].each do |reason|
          describe reason do
            subject { Reject.new :reason => reason }

            let :expected_message do
              <<-MESSAGE
<reject xmlns="urn:xmpp:rayo:1">
  <#{reason}/>
</reject>
              MESSAGE
            end

            its(:reason) { should == reason }
          end
        end

        describe "blahblahblah" do
          it "should raise an error" do
            expect { Reject.new(:reason => :blahblahblah) }.to raise_error ArgumentError
          end
        end
      end
    end
  end
end # Punchblock

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
punchblock-0.5.1 spec/punchblock/command/reject_spec.rb
punchblock-0.5.0 spec/punchblock/command/reject_spec.rb
punchblock-0.4.3 spec/punchblock/command/reject_spec.rb
punchblock-0.4.2 spec/punchblock/command/reject_spec.rb
punchblock-0.4.1 spec/punchblock/command/reject_spec.rb
punchblock-0.4.0 spec/punchblock/command/reject_spec.rb