Sha256: 3513af357bb37842e895ec1327bbf547c6ed82e6df4e906fbd178b89f6f19fc7

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

class OptionsTest < Test::Unit::TestCase
  include FSM::Options::InstanceMethods
  context 'assert_options' do
    should 'allow empty options' do
      assert_options({})
    end
    should('throw on unknown key') do
      assert_raise(ArgumentError) do
        assert_options({:foo => 12}, [], [])
      end
      assert_raise(ArgumentError) do
        assert_options({:foo => 12}, [:optional], [])
      end
      assert_raise(ArgumentError) do
        assert_options({:foo => 12}, [], [:mandatory])
      end
      assert_raise(ArgumentError) do
        assert_options({:foo => 12}, [:optional], [:mandatory])
      end
    end
    should('find missong mandatory options') do
      assert_raise(ArgumentError) do
        assert_options({}, [], [:foo])
      end
      assert_raise(ArgumentError) do
        assert_options({:foo => 12}, [], [:bar])
      end
      assert_raise(ArgumentError) do
        assert_options({:foo => 12}, [:bar], [:bar])
      end
      assert_options({:foo => 42}, [], [:foo])
      assert_options({:foo => 42}, [:foo], [:foo])
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
simplificator-fsm-0.2.0 test/options_test.rb
simplificator-fsm-0.2.1 test/options_test.rb
simplificator-fsm-0.2.2 test/options_test.rb
simplificator-fsm-0.2.3 test/options_test.rb
simplificator-fsm-0.2.4 test/options_test.rb
simplificator-fsm-0.3.0 test/options_test.rb
simplificator-fsm-0.3.2 test/options_test.rb
simplificator-fsm-0.3.3 test/options_test.rb
simplificator-fsm-0.3.5 test/options_test.rb
simplificator-fsm-0.3.9 test/options_test.rb
simplificator-fsm-0.3.8 test/options_test.rb
simplificator-fsm-0.3.7 test/options_test.rb