Sha256: 54ef559f1c5024490a7d05ba84dda22dcbb99012cf8131c7708d313d0aaa4ade

Contents?: true

Size: 839 Bytes

Versions: 14

Compression:

Stored size: 839 Bytes

Contents

require_relative '../../test_helper'

class BranchTest < StateMachinesTest
  def setup
    @branch = StateMachines::Branch.new(from: :parked, to: :idling)
  end

  def test_should_not_raise_exception_if_implicit_option_specified
    StateMachines::Branch.new(invalid: :valid)
  end

  def test_should_not_have_an_if_condition
    assert_nil @branch.if_condition
  end

  def test_should_not_have_an_unless_condition
    assert_nil @branch.unless_condition
  end

  def test_should_have_a_state_requirement
    assert_equal 1, @branch.state_requirements.length
  end

  def test_should_raise_an_exception_if_invalid_match_option_specified
    exception = assert_raises(ArgumentError) { @branch.match(Object.new, invalid: true) }
    assert_equal 'Unknown key: :invalid. Valid keys are: :from, :to, :on, :guard', exception.message
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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