Sha256: fc32d0e4d7158ad547c78634023c126a7e774128f39f9b8631c7a541f31497e2

Contents?: true

Size: 786 Bytes

Versions: 4

Compression:

Stored size: 786 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe FiniteMachine::HookEvent, 'eql?' do
  let(:name)       { :green }
  let(:transition) { double(:transition) }
  let(:data)       { [:foo, :bar] }
  let(:object)     { described_class }

  subject(:hook) { object.new(name, transition, *data) }

  context 'with the same object' do
   let(:other) { hook }

    it "equals" do
      expect(hook).to eql(other)
    end
  end

  context 'with an equivalent object' do
    let(:other) { hook.dup }

    it "equals" do
      expect(hook).to eql(other)
    end
  end

  context "with an object having different name" do
    let(:other_name) { :red }
    let(:other) { object.new(other_name, transition, *data) }

    it "doesn't equal" do
      expect(hook).not_to eql(other)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
finite_machine-0.10.0 spec/unit/hook_event/eql_spec.rb
finite_machine-0.9.2 spec/unit/hook_event/eql_spec.rb
finite_machine-0.9.1 spec/unit/hook_event/eql_spec.rb
finite_machine-0.9.0 spec/unit/hook_event/eql_spec.rb