rubikon 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/option_tests.rb DELETED
@@ -1,75 +0,0 @@
1
- # This code is free software; you can redistribute it and/or modify it under
2
- # the terms of the new BSD License.
3
- #
4
- # Copyright (c) 2010, Sebastian Staudt
5
-
6
- require 'test_helper'
7
-
8
- class FlagTests < Test::Unit::TestCase
9
-
10
- context 'A Rubikon option' do
11
-
12
- should 'be a Parameter' do
13
- assert Option.included_modules.include?(Parameter)
14
- assert Option.new(:test).is_a?(Parameter)
15
- end
16
-
17
- should 'call its code block if it is activated' do
18
- block_run = false
19
- option = Option.new :test do
20
- block_run = true
21
- end
22
- option.active!
23
- assert option.active?
24
- assert block_run
25
- end
26
-
27
- should 'have arguments' do
28
- option = Option.new :test
29
- assert option.respond_to?(:arg_count)
30
- assert option.respond_to?(:args)
31
- end
32
-
33
- should 'only have required arguments if argument count is > 0' do
34
- option = Option.new :test, 2
35
- assert !option.args_full?
36
- assert option.more_args?
37
- option << 'argument'
38
- assert_equal %w{argument}, option.args
39
- assert_raise MissingArgumentError do
40
- option.check_args
41
- end
42
- option << 'argument'
43
- assert option.args_full?
44
- assert !option.more_args?
45
- assert_equal %w{argument argument}, option.args
46
- assert_raise ExtraArgumentError do
47
- option << 'argument'
48
- end
49
- assert_equal %w{argument argument}, option.args
50
- end
51
-
52
- should 'have required and optional arguments if argument count is < 0' do
53
- option = Option.new :test, -1
54
- assert !option.args_full?
55
- assert option.more_args?
56
- assert_raise MissingArgumentError do
57
- option.check_args
58
- end
59
- option << 'argument'
60
- assert option.args_full?
61
- assert option.more_args?
62
- assert_equal %w{argument}, option.args
63
- end
64
-
65
- should 'only have optional arguments if argument count is 0' do
66
- option = Option.new :test, 0
67
- assert option.args_full?
68
- assert option.more_args?
69
- option << 'argument'
70
- assert_equal %w{argument}, option.args
71
- end
72
-
73
- end
74
-
75
- end