Sha256: 235493ad39779337accf6381cddc300083646a2c8ef81b910d22a99661a46fbb

Contents?: true

Size: 754 Bytes

Versions: 4

Compression:

Stored size: 754 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe FiniteMachine::Event, 'eql?' do
  let(:machine) { double(:machine) }
  let(:name)    { :green }
  let(:options) { {} }
  let(:object)  { described_class }

  subject(:event) { object.new(machine, options) }

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

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

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

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

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

    it "doesn't equal" do
      expect(event).to_not eql(other)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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