Sha256: 97925332fffe13510b1db460b8648f7c3f626f9e2347308d76801ffa01f8c9f6
Contents?: true
Size: 806 Bytes
Versions: 6
Compression:
Stored size: 806 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe FiniteMachine, 'states' do it "retrieves all available states" do fsm = FiniteMachine.define do initial :green events { event :slow, :green => :yellow event :stop, :yellow => :red event :ready, :red => :yellow event :go, :yellow => :green } end expect(fsm.states).to match_array([:none, :green, :yellow, :red]) end it "retrieves all unique states for choice transition" do fsm = FiniteMachine.define do initial :green events { event :next, from: :green do choice :yellow, if: -> { false } choice :red, if: -> { true } end } end expect(fsm.states).to match_array([:none, :green, :yellow, :red]) end end
Version data entries
6 entries across 6 versions & 1 rubygems