Sha256: 94e8317d2e9a77dd0f9c30dab29b8d3c76075bc8f22ee3a363f0186c2d79dd27

Contents?: true

Size: 1.8 KB

Versions: 8

Compression:

Stored size: 1.8 KB

Contents

# encoding: utf-8
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

8 entries across 8 versions & 1 rubygems

Version Path
ruby_ami-1.3.4 spec/ruby_ami/event_spec.rb
ruby_ami-1.3.3 spec/ruby_ami/event_spec.rb
ruby_ami-1.3.2 spec/ruby_ami/event_spec.rb
ruby_ami-1.3.1 spec/ruby_ami/event_spec.rb
ruby_ami-1.3.0 spec/ruby_ami/event_spec.rb
ruby_ami-1.2.6 spec/ruby_ami/event_spec.rb
ruby_ami-1.2.5 spec/ruby_ami/event_spec.rb
ruby_ami-1.2.4 spec/ruby_ami/event_spec.rb