Sha256: 10c9400db89d36434495e823bfa221c3abbed6f5cc2e8ad2e6b2b71fdf41a59c

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

2 entries across 2 versions & 1 rubygems

Version Path
finite_machine-0.10.2 spec/unit/events_chain/insert_spec.rb
finite_machine-0.10.1 spec/unit/events_chain/insert_spec.rb