Sha256: ba0faa9e86fa982706c87f0133eb236b560598144a8d531fd72aea52abe68366

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

RSpec.describe FiniteMachine::HookEvent, 'eql?' do
  let(:name)       { :green }
  let(:event_name) { :go }
  let(:object)     { described_class }

  subject(:hook) { object.new(name, event_name, name) }

  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, event_name, other_name) }

    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.12.1 spec/unit/hook_event/eql_spec.rb
finite_machine-0.12.0 spec/unit/hook_event/eql_spec.rb