Sha256: 108eb344b79fca197b2d26775ae742d7ca483763306d8a25fce06038a8497fdf

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

require_relative "helper"

setup do
  machine = MicroMachine.new(:pending)

  machine.when(:confirm, pending: :confirmed)
  machine.when(:ignore, pending: :ignored)
  machine.when(:reset, confirmed: :pending, ignored: :pending)

  machine
end

test "returns an array with the defined events" do |machine|
  assert_equal [:confirm, :ignore, :reset], machine.events
end

test "list the available events for the current state" do |machine|
  assert_equal [:confirm, :ignore], machine.triggerable_events
end

test "returns an array with the defined states" do |machine|
  assert_equal [:pending, :confirmed, :ignored], machine.states
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
micromachine-3.0.0 test/introspection.rb
micromachine-2.1.0 test/introspection.rb