Sha256: 2ef3e77e9344754feb261c901c0a5164040e5c0a8b1cad70251da6a2e784acea

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.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

2 entries across 2 versions & 1 rubygems

Version Path
finite_machine-0.10.2 spec/unit/hook_event/eql_spec.rb
finite_machine-0.10.1 spec/unit/hook_event/eql_spec.rb