Sha256: 05f4731397426495563b57653e51797fd7b6b769894888933faa0c6d44b4e247

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 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/clear_spec.rb
finite_machine-0.10.1 spec/unit/events_chain/clear_spec.rb