Sha256: 58f9c4dc224943e4eb6a8c8e556f91d4b28ffb318832e372cce2bdb57832f862

Contents?: true

Size: 469 Bytes

Versions: 14

Compression:

Stored size: 469 Bytes

Contents

require_relative '../../test_helper'

class StateWithMatcherTest < StateMachinesTest
  def setup
    @klass = Class.new
    @args = nil
    @machine = StateMachines::Machine.new(@klass)
    @machine.states << @state = StateMachines::State.new(@machine, :parked, if: lambda { |value| value == 1 })
  end

  def test_should_not_match_actual_value
    refute @state.matches?('parked')
  end

  def test_should_match_evaluated_block
    assert @state.matches?(1)
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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