Sha256: 2579631bdd96ae5427612049b9e17bdf1ea50d6a6ac0524b5abdc0618c30ea93

Contents?: true

Size: 558 Bytes

Versions: 4

Compression:

Stored size: 558 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.describe FiniteMachine, '#inspect' do
  it "print useful information about state machine" do
    fsm = FiniteMachine.define do
      initial :green

      events {
        event :slow,  :green  => :yellow
        event :stop,  :yellow => :red
      }
    end
    expect(fsm.inspect).to match(/^<#FiniteMachine::StateMachine:0x#{fsm.object_id.to_s(16)} @states=\[:none, :green, :yellow, :red\], @events=\[:init, :slow, :stop\], @transitions=\[{:none=>:green}, {:green=>:yellow}, {:yellow=>:red}\]>$/)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
finite_machine-0.11.3 spec/unit/inspect_spec.rb
finite_machine-0.11.2 spec/unit/inspect_spec.rb
finite_machine-0.11.1 spec/unit/inspect_spec.rb
finite_machine-0.11.0 spec/unit/inspect_spec.rb