Sha256: 2f7105e4e09bbbc4e8db6963de268a4e0c261603504e6094bb6882f3be8d8f67

Contents?: true

Size: 1.78 KB

Versions: 6

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'

module RubyAMI
  describe Event do
    describe "equality" do
      context "with the same name and the same headers" do
        let :event1 do
          Event.new('Hangup').tap do |e|
            e['Channel'] = 'SIP/101-3f3f'
            e['Uniqueid'] = '1094154427.10'
            e['Cause'] = '0'
          end
        end

        let :event2 do
          Event.new('Hangup').tap do |e|
            e['Channel'] = 'SIP/101-3f3f'
            e['Uniqueid'] = '1094154427.10'
            e['Cause'] = '0'
          end
        end

        it "should be equal" do
          event1.should be == event2
        end
      end

      context "with a different name and the same headers" do
        let :event1 do
          Event.new('Hangup').tap do |e|
            e['Channel'] = 'SIP/101-3f3f'
            e['Uniqueid'] = '1094154427.10'
            e['Cause'] = '0'
          end
        end

        let :event2 do
          Event.new('Foo').tap do |e|
            e['Channel'] = 'SIP/101-3f3f'
            e['Uniqueid'] = '1094154427.10'
            e['Cause'] = '0'
          end
        end

        it "should not be equal" do
          event1.should_not be == event2
        end
      end

      context "with the same name and different headers" do
        let :event1 do
          Event.new('Hangup').tap do |e|
            e['Channel'] = 'SIP/101-3f3f'
            e['Uniqueid'] = '1094154427.10'
            e['Cause'] = '0'
          end
        end

        let :event2 do
          Event.new('Hangup').tap do |e|
            e['Channel'] = 'SIP/101-3f3f'
            e['Uniqueid'] = '1094154427.10'
            e['Cause'] = '1'
          end
        end

        it "should not be equal" do
          event1.should_not be == event2
        end
      end
    end
  end # Event
end # RubyAMI

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_ami-1.2.3 spec/ruby_ami/event_spec.rb
ruby_ami-1.2.2 spec/ruby_ami/event_spec.rb
ruby_ami-1.2.1 spec/ruby_ami/event_spec.rb
ruby_ami-1.2.0 spec/ruby_ami/event_spec.rb
ruby_ami-1.1.2 spec/ruby_ami/event_spec.rb
ruby_ami-1.1.1 spec/ruby_ami/event_spec.rb