Sha256: bcd9534ee4b62d283f1af92d47d356a0aa9a1c1bdcc6371786b74f5cb53c40d9

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe FiniteMachine::EventsChain, '#insert' do
  let(:object)  { described_class }

  let(:machine) { double(:machine) }

  let(:transition) { double(:transition) }

  subject(:chain) { object.new(machine) }

  it "inserts transition" do
    event = double(:event)
    chain.add(:validated, event)
    expect(chain[:validated]).to eq(event)

    expect(event).to receive(:<<).with(transition)
    chain.insert(:validated, transition)
  end

  it "fails to insert transition" do
    expect(chain.insert(:validated, transition)).to be(false)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
finite_machine-0.10.0 spec/unit/events_chain/clear_spec.rb
finite_machine-0.9.2 spec/unit/events_chain/clear_spec.rb
finite_machine-0.9.1 spec/unit/events_chain/clear_spec.rb
finite_machine-0.9.0 spec/unit/events_chain/clear_spec.rb