Sha256: 0e7d972a3e658cffb3fc55bea58bbfbd916636a4590fadd99d84a9346624392e
Contents?: true
Size: 510 Bytes
Versions: 4
Compression:
Stored size: 510 Bytes
Contents
# encoding: utf-8 require 'spec_helper' RSpec.describe FiniteMachine::StateMachine, '.trigger' do it "triggers event manually" do called = [] fsm = FiniteMachine.define do initial :red events { event :start, :red => :green, if: proc { |_, name| called << name; true } event :stop, :green => :red } end expect(fsm.current).to eq(:red) fsm.trigger(:start, 'Piotr') expect(fsm.current).to eq(:green) expect(called).to eq(['Piotr']) end end
Version data entries
4 entries across 4 versions & 1 rubygems