Sha256: c53ca648b1a5bc82b2667ded748c47db44e9aeb0e884f5b7416e6da6f681328d

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

require "spec_helper"

describe Invoker::IPC::Message do
  describe "test equality of objects" do
    context "for simple messages" do
      let(:message) { MM::Add.new(process_name: 'foo') }

      it "object should be reported same if same value" do
        m2 = MM::Add.new(process_name: 'foo')
        expect(message).to eql m2
      end

      it "should report objects to be not eql if differnt value" do
        m2 = MM::Add.new(process_name: 'bar')
        expect(message).to_not eql m2
      end
    end

    context "for nested messages" do
      let(:process_array) do
        [
          { shell_command: 'foo', process_name: 'foo', dir: '/tmp', pid: 100,
            port: 9000 },
          { shell_command: 'bar', process_name: 'bar', dir: '/tmp', pid: 200,
            port: 9001 }
        ]
      end

      let(:message) { MM::ListResponse.new(processes: process_array) }

      it "should report eql for eql objects" do
        m2 = MM::ListResponse.new(processes: process_array)
        expect(message).to eql m2
      end

      it "should report not equal for different objects" do
        another_process_array = [
          { shell_command: 'baz', process_name: 'foo', dir: '/tmp', pid: 100,
            port: 9000 },
          { shell_command: 'bar', process_name: 'bar', dir: '/tmp', pid: 200,
            port: 9001 }
        ]

        m2 = MM::ListResponse.new(processes: another_process_array)
        expect(message).to_not eql m2
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
itrg-invoker-1.6.1 spec/invoker/ipc/message_spec.rb
itrg-invoker-1.6.0 spec/invoker/ipc/message_spec.rb
invoker-1.5.8 spec/invoker/ipc/message_spec.rb
invoker-1.5.7 spec/invoker/ipc/message_spec.rb
invoker-1.5.6 spec/invoker/ipc/message_spec.rb
invoker-1.5.5 spec/invoker/ipc/message_spec.rb
invoker-1.5.4 spec/invoker/ipc/message_spec.rb
invoker-1.5.3 spec/invoker/ipc/message_spec.rb
meepo-1.5.2 spec/invoker/ipc/message_spec.rb
invoker-1.5.1 spec/invoker/ipc/message_spec.rb
invoker-1.4.1 spec/invoker/ipc/message_spec.rb
invoker-1.4.0 spec/invoker/ipc/message_spec.rb