Sha256: ab8159976c443d6c08fc5705a3829bb482a75983fc72df3f1378d06ed895b092
Contents?: true
Size: 638 Bytes
Versions: 2
Compression:
Stored size: 638 Bytes
Contents
RSpec.describe FiniteMachine, ':log_transitions' do let(:output) { StringIO.new('', 'w+')} before { FiniteMachine.logger = ::Logger.new(output) } after { FiniteMachine.logger = ::Logger.new($stderr) } it "logs transitions" do fsm = FiniteMachine.new log_transitions: true do initial :green event :slow, :green => :yellow event :stop, :yellow => :red end fsm.slow output.rewind expect(output.read).to match(/Transition: @event=slow green -> yellow/) fsm.stop(1, 2) output.rewind expect(output.read).to match(/Transition: @event=stop @with=\[1,2\] yellow -> red/) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finite_machine-0.12.1 | spec/unit/log_transitions_spec.rb |
finite_machine-0.12.0 | spec/unit/log_transitions_spec.rb |