Sha256: 5d58b05ffa3d8a691d91dabe233c875dd84caa431c714e86c92f47e78dc371fc

Contents?: true

Size: 473 Bytes

Versions: 14

Compression:

Stored size: 473 Bytes

Contents

require_relative '../../test_helper'

class MachineWithStatesWithCustomValuesTest < StateMachinesTest
  def setup
    @klass = Class.new
    @machine = StateMachines::Machine.new(@klass)
    @state = @machine.state :parked, value: 1

    @object = @klass.new
    @object.state = 1
  end

  def test_should_use_custom_value
    assert_equal 1, @state.value
  end

  def test_should_allow_lookup_by_custom_value
    assert_equal @state, @machine.states[1, :value]
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
state_machines-0.5.0 test/unit/machine/machine_with_states_with_custom_values_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/machine/machine_with_states_with_custom_values_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/machine/machine_with_states_with_custom_values_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.4.0 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.3.0 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.2.2 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.2.1 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.2.0 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.1.4 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.1.3 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.1.2 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.1.1 test/unit/machine/machine_with_states_with_custom_values_test.rb
state_machines-0.1.0 test/unit/machine/machine_with_states_with_custom_values_test.rb