Sha256: 9ea0ec8afb3a8f377cd47a0ea9367b95a1c295a6da985225502ebc4a100cc6e1

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

4 entries across 4 versions & 1 rubygems

Version Path
finite_machine-0.11.3 spec/unit/hook_event/eql_spec.rb
finite_machine-0.11.2 spec/unit/hook_event/eql_spec.rb
finite_machine-0.11.1 spec/unit/hook_event/eql_spec.rb
finite_machine-0.11.0 spec/unit/hook_event/eql_spec.rb