Sha256: fbb55fd0eea53e99e3fad03d142bd1be186afad5b28766c36162ade11162da43

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

2 entries across 2 versions & 1 rubygems

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