File: machine_with_dynamic_initial_state_test.rb

package info (click to toggle)
ruby-state-machines-activemodel 0.101.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 320 kB
  • sloc: ruby: 1,222; makefile: 6; sh: 4
file content (16 lines) | stat: -rw-r--r-- 424 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

require 'test_helper'

class MachineWithDynamicInitialStateTest < BaseTestCase
  def setup
    @model = new_model
    @machine = StateMachines::Machine.new(@model, initial: lambda { |_object| :parked }, integration: :active_model)
    @machine.state :parked
  end

  def test_should_set_initial_state_on_created_object
    record = @model.new
    assert_equal 'parked', record.state
  end
end