Sha256: 9b228a4ec56dd8c305fe8c5278b7e30b7be0262326e7ff9b893ec98b35578d1a

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'

class TransitionTest < Test::Unit::TestCase
  context 'Initializer' do
    
    
    should 'require name, from and to' do
      bli_state = FSM::State.new('bli', self)
      blo_state = FSM::State.new('blo', self)
      assert_raise(ArgumentError) do
        FSM::Transition.new(nil, nil, nil)
      end
      assert_raise(ArgumentError) do
        FSM::Transition.new(:name, nil, nil)
      end
      assert_raise(ArgumentError) do
        FSM::Transition.new(nil, bli_state, nil)
      end
      assert_raise(ArgumentError) do
        FSM::Transition.new(nil, nil, blo_state)
      end
      assert_raise(ArgumentError) do
        FSM::Transition.new(:name, bli_state, nil)
      end
      assert_raise(ArgumentError) do
        FSM::Transition.new(nil, blo_state, blo_state)
      end
      assert_raise(ArgumentError) do
        FSM::Transition.new(:name, nil, bli_state)
      end
      
      FSM::Transition.new(:name, bli_state, blo_state)
    end
    
    should 'allow only valid options' do
      bli_state = FSM::State.new('bli', self)
      blo_state = FSM::State.new('blo', self)
      assert_raise(ArgumentError) do
        FSM::Transition.new(:name, bli_state, blo_state, :foo => 12)
      end
      FSM::Transition.new(:name, bli_state, blo_state, :event => :some)
      FSM::Transition.new(:name, bli_state, blo_state, :guard => :some)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simplificator-fsm-0.3.0 test/transition_test.rb
simplificator-fsm-0.3.2 test/transition_test.rb
simplificator-fsm-0.3.3 test/transition_test.rb
simplificator-fsm-0.3.5 test/transition_test.rb
simplificator-fsm-0.3.9 test/transition_test.rb
simplificator-fsm-0.3.8 test/transition_test.rb
simplificator-fsm-0.3.7 test/transition_test.rb