Sha256: dea5ab04a1ab9e97f04f15f5cbad0a2adcb61af08138d3b4b1e0543ff28cdc4a

Contents?: true

Size: 1.5 KB

Versions: 9

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

module Punchblock
  describe ProtocolError do
    let(:name)          { :item_not_found }
    let(:text)          { 'Could not find call [id=f6d437f4-1e18-457b-99f8-b5d853f50347]' }
    let(:call_id)       { 'f6d437f4-1e18-457b-99f8-b5d853f50347' }
    let(:component_id)  { 'abc123' }
    subject { ProtocolError.new name, text, call_id, component_id }

    its(:inspect) { should == '#<Punchblock::ProtocolError: name=:item_not_found text="Could not find call [id=f6d437f4-1e18-457b-99f8-b5d853f50347]" call_id="f6d437f4-1e18-457b-99f8-b5d853f50347" component_id="abc123">' }

    describe "comparison" do
      context "with the same name, text, call ID and component ID" do
        let(:comparison) { ProtocolError.new name, text, call_id, component_id }
        it { should == comparison }
      end

      context "with a different name" do
        let(:comparison) { ProtocolError.new :foo, text, call_id, component_id }
        it { should_not == comparison }
      end

      context "with a different text" do
        let(:comparison) { ProtocolError.new name, 'foo', call_id, component_id }
        it { should_not == comparison }
      end

      context "with a different call ID" do
        let(:comparison) { ProtocolError.new name, text, 'foo', component_id }
        it { should_not == comparison }
      end

      context "with a different component ID" do
        let(:comparison) { ProtocolError.new name, text, call_id, 'foo' }
        it { should_not == comparison }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
punchblock-0.9.2 spec/punchblock/protocol_error_spec.rb
punchblock-0.9.1 spec/punchblock/protocol_error_spec.rb
punchblock-0.9.0 spec/punchblock/protocol_error_spec.rb
punchblock-0.8.4 spec/punchblock/protocol_error_spec.rb
punchblock-0.8.3 spec/punchblock/protocol_error_spec.rb
punchblock-0.8.2 spec/punchblock/protocol_error_spec.rb
punchblock-0.8.1 spec/punchblock/protocol_error_spec.rb
punchblock-0.8.0 spec/punchblock/protocol_error_spec.rb
punchblock-0.7.2 spec/punchblock/protocol_error_spec.rb