Sha256: 0549891c63a4986115b96c4be3308bdb6b82ba9ce23317e6bfd117c2889c2e32
Contents?: true
Size: 469 Bytes
Versions: 2
Compression:
Stored size: 469 Bytes
Contents
# frozen_string_literal: true RSpec.describe FiniteMachine::StateMachine, '#trigger' do it "triggers event manually" do called = [] fsm = FiniteMachine.new do initial :red 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finite_machine-0.12.1 | spec/unit/trigger_spec.rb |
finite_machine-0.12.0 | spec/unit/trigger_spec.rb |