cli 1.2.0 → 1.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.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -7
  3. data/Gemfile.lock +29 -37
  4. data/README.md +43 -44
  5. data/Rakefile +1 -28
  6. data/cli.gemspec +14 -84
  7. data/examples/httpclient +6 -6
  8. data/examples/ls +4 -4
  9. data/examples/processor +5 -5
  10. data/examples/sinatra +9 -9
  11. data/lib/cli/dsl.rb +3 -3
  12. data/rdoc/CLI/Arguments.html +178 -0
  13. data/rdoc/CLI/DSL/Argument.html +200 -0
  14. data/rdoc/CLI/DSL/Arguments.html +172 -0
  15. data/rdoc/CLI/DSL/Base.html +154 -0
  16. data/rdoc/CLI/DSL/Cast.html +152 -0
  17. data/rdoc/CLI/DSL/Description.html +150 -0
  18. data/rdoc/CLI/DSL/Input.html +143 -0
  19. data/rdoc/CLI/DSL/MultiDefault.html +151 -0
  20. data/rdoc/CLI/DSL/Option.html +143 -0
  21. data/rdoc/CLI/DSL/Options.html +142 -0
  22. data/rdoc/CLI/DSL/Switch.html +267 -0
  23. data/rdoc/CLI/DSL/Value.html +238 -0
  24. data/rdoc/CLI/DSL.html +91 -0
  25. data/rdoc/CLI/Options.html +200 -0
  26. data/rdoc/CLI/ParserError/ArgumentNameSpecifiedTwice.html +138 -0
  27. data/rdoc/CLI/ParserError/LongNameSpecifiedTwiceError.html +138 -0
  28. data/rdoc/CLI/ParserError/MultipleArgumentsSpecifierError.html +138 -0
  29. data/rdoc/CLI/ParserError/NameArgumetNotSymbolError.html +138 -0
  30. data/rdoc/CLI/ParserError/OptionsArgumentNotHashError.html +138 -0
  31. data/rdoc/CLI/ParserError/ShortNameIsInvalidError.html +138 -0
  32. data/rdoc/CLI/ParserError/ShortNameNotSymbolError.html +138 -0
  33. data/rdoc/CLI/ParserError/ShortNameSpecifiedTwiceError.html +138 -0
  34. data/rdoc/CLI/ParserError.html +97 -0
  35. data/rdoc/CLI/ParsingError/CastError.html +138 -0
  36. data/rdoc/CLI/ParsingError/MandatoryArgumentNotSpecifiedError.html +138 -0
  37. data/rdoc/CLI/ParsingError/MandatoryOptionsNotSpecifiedError.html +138 -0
  38. data/rdoc/CLI/ParsingError/MissingOptionValueError.html +138 -0
  39. data/rdoc/CLI/ParsingError/UnknownSwitchError.html +138 -0
  40. data/rdoc/CLI/ParsingError/UsageError.html +97 -0
  41. data/rdoc/CLI/ParsingError.html +97 -0
  42. data/rdoc/CLI/Switches.html +306 -0
  43. data/rdoc/CLI/Values.html +202 -0
  44. data/rdoc/CLI.html +652 -0
  45. data/rdoc/README_md.html +553 -0
  46. data/rdoc/created.rid +7 -0
  47. data/rdoc/css/fonts.css +167 -0
  48. data/rdoc/css/rdoc.css +639 -0
  49. data/rdoc/fonts/Lato-Light.ttf +0 -0
  50. data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
  51. data/rdoc/fonts/Lato-Regular.ttf +0 -0
  52. data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
  53. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  54. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  55. data/rdoc/images/add.png +0 -0
  56. data/rdoc/images/arrow_up.png +0 -0
  57. data/rdoc/images/brick.png +0 -0
  58. data/rdoc/images/brick_link.png +0 -0
  59. data/rdoc/images/bug.png +0 -0
  60. data/rdoc/images/bullet_black.png +0 -0
  61. data/rdoc/images/bullet_toggle_minus.png +0 -0
  62. data/rdoc/images/bullet_toggle_plus.png +0 -0
  63. data/rdoc/images/date.png +0 -0
  64. data/rdoc/images/delete.png +0 -0
  65. data/rdoc/images/find.png +0 -0
  66. data/rdoc/images/loadingAnimation.gif +0 -0
  67. data/rdoc/images/macFFBgHack.png +0 -0
  68. data/rdoc/images/package.png +0 -0
  69. data/rdoc/images/page_green.png +0 -0
  70. data/rdoc/images/page_white_text.png +0 -0
  71. data/rdoc/images/page_white_width.png +0 -0
  72. data/rdoc/images/plugin.png +0 -0
  73. data/rdoc/images/ruby.png +0 -0
  74. data/rdoc/images/tag_blue.png +0 -0
  75. data/rdoc/images/tag_green.png +0 -0
  76. data/rdoc/images/transparent.png +0 -0
  77. data/rdoc/images/wrench.png +0 -0
  78. data/rdoc/images/wrench_orange.png +0 -0
  79. data/rdoc/images/zoom.png +0 -0
  80. data/rdoc/index.html +120 -0
  81. data/rdoc/js/darkfish.js +84 -0
  82. data/rdoc/js/navigation.js +105 -0
  83. data/rdoc/js/navigation.js.gz +0 -0
  84. data/rdoc/js/search.js +110 -0
  85. data/rdoc/js/search_index.js +1 -0
  86. data/rdoc/js/search_index.js.gz +0 -0
  87. data/rdoc/js/searcher.js +229 -0
  88. data/rdoc/js/searcher.js.gz +0 -0
  89. data/rdoc/table_of_contents.html +533 -0
  90. data/spec/argument_spec.rb +122 -99
  91. data/spec/cli_spec.rb +27 -28
  92. data/spec/conflict_reporting_spec.rb +16 -17
  93. data/spec/option_spec.rb +79 -56
  94. data/spec/separator_spec.rb +19 -20
  95. data/spec/stdin_spec.rb +13 -14
  96. data/spec/switch_spec.rb +15 -16
  97. data/spec/usage_spec.rb +80 -81
  98. metadata +91 -104
  99. data/.document +0 -5
  100. data/.rspec +0 -1
  101. data/VERSION +0 -1
  102. data/features/cli.feature +0 -9
  103. data/features/step_definitions/cli_steps.rb +0 -0
  104. data/features/support/env.rb +0 -13
data/spec/option_spec.rb CHANGED
@@ -6,32 +6,56 @@ describe CLI do
6
6
  ps = CLI.new do
7
7
  option :location
8
8
  end.parse(['--location', 'singapore'])
9
- ps.location.should be_a String
10
- ps.location.should == 'singapore'
9
+ expect(ps.location).to be_a String
10
+ expect(ps.location).to eq 'singapore'
11
11
  end
12
12
 
13
13
  it "should handle short option names" do
14
14
  ps = CLI.new do
15
15
  option :location, :short => :l
16
16
  end.parse(['-l', 'singapore'])
17
- ps.location.should be_a String
18
- ps.location.should == 'singapore'
17
+ expect(ps.location).to be_a String
18
+ expect(ps.location).to eq 'singapore'
19
19
  end
20
20
 
21
21
  it "should support casting" do
22
22
  ps = CLI.new do
23
23
  option :size, :cast => Integer
24
24
  end.parse(['--size', '24'])
25
- ps.size.should be_a Integer
26
- ps.size.should == 24
25
+ expect(ps.size).to be_a Integer
26
+ expect(ps.size).to eq 24
27
+ end
28
+
29
+ it "casting should fail if not proper integer given" do
30
+ expect {
31
+ ps = CLI.new do
32
+ option :size, :cast => Integer
33
+ end.parse(['--size', '24.99'])
34
+ }.to raise_error(CLI::ParsingError::CastError)
35
+ end
36
+
37
+ it "casting should fail if not proper float given" do
38
+ expect {
39
+ ps = CLI.new do
40
+ option :size, :cast => Float
41
+ end.parse(['--size', '24.99x'])
42
+ }.to raise_error(CLI::ParsingError::CastError)
43
+ end
44
+
45
+ it "casting should fail if there is error in cast lambda" do
46
+ expect {
47
+ ps = CLI.new do
48
+ option :size, :cast => lambda{|v| fail 'test'}
49
+ end.parse(['--size', '24.99x'])
50
+ }.to raise_error(CLI::ParsingError::CastError)
27
51
  end
28
52
 
29
53
  it "should support casting of multiple options" do
30
54
  ps = CLI.new do
31
55
  options :size, :cast => Integer
32
56
  end.parse(['--size', '24', '--size', '10'])
33
- ps.size.should be_a Array
34
- ps.size.should == [24, 10]
57
+ expect(ps.size).to be_a Array
58
+ expect(ps.size).to eq [24, 10]
35
59
  end
36
60
 
37
61
  it "should support casting of multiple options with default" do
@@ -39,22 +63,22 @@ describe CLI do
39
63
  options :log_file, :cast => Pathname, :default => 'test.log'
40
64
  end.parse(['--log-file', 'server.log', '--log-file', 'error.log'])
41
65
 
42
- ps.log_file.should be_a Array
43
- ps.log_file.length.should == 2
66
+ expect(ps.log_file).to be_a Array
67
+ expect(ps.log_file.length).to eq 2
44
68
 
45
- ps.log_file.first.should be_a Pathname
46
- ps.log_file.first.to_s.should == 'server.log'
69
+ expect(ps.log_file.first).to be_a Pathname
70
+ expect(ps.log_file.first.to_s).to eq 'server.log'
47
71
 
48
- ps.log_file.last.should be_a Pathname
49
- ps.log_file.last.to_s.should == 'error.log'
72
+ expect(ps.log_file.last).to be_a Pathname
73
+ expect(ps.log_file.last.to_s).to eq 'error.log'
50
74
  end
51
75
 
52
76
  it "should support casting with lambda" do
53
77
  ps = CLI.new do
54
78
  option :size, :cast => lambda{|v| v.to_i + 2}
55
79
  end.parse(['--size', '24'])
56
- ps.size.should be_a Integer
57
- ps.size.should == 26
80
+ expect(ps.size).to be_a Integer
81
+ expect(ps.size).to eq 26
58
82
  end
59
83
 
60
84
  it "should support casting with class" do
@@ -68,8 +92,8 @@ describe CLI do
68
92
  ps = CLI.new do
69
93
  option :text, :cast => Upcaser
70
94
  end.parse(['--text', 'hello world'])
71
- ps.text.should be_a Upcaser
72
- ps.text.value.should == 'HELLO WORLD'
95
+ expect(ps.text).to be_a Upcaser
96
+ expect(ps.text.value).to eq 'HELLO WORLD'
73
97
  end
74
98
 
75
99
  it "should handle default values" do
@@ -77,36 +101,36 @@ describe CLI do
77
101
  option :location, :default => 'singapore'
78
102
  option :size, :cast => Integer, :default => 23
79
103
  end.parse([])
80
- ps.location.should be_a String
81
- ps.location.should == 'singapore'
82
- ps.size.should be_a Integer
83
- ps.size.should == 23
104
+ expect(ps.location).to be_a String
105
+ expect(ps.location).to eq 'singapore'
106
+ expect(ps.size).to be_a Integer
107
+ expect(ps.size).to eq 23
84
108
  end
85
109
 
86
110
  it "default value is casted" do
87
111
  ps = CLI.new do
88
112
  option :location, :default => 'singapore'
89
- option :size, :cast => Integer, :default => 23.99
113
+ option :size, :cast => Integer, :default => 23
90
114
  end.parse([])
91
- ps.location.should be_a String
92
- ps.location.should == 'singapore'
93
- ps.size.should be_a Integer
94
- ps.size.should == 23
115
+ expect(ps.location).to be_a String
116
+ expect(ps.location).to eq 'singapore'
117
+ expect(ps.size).to be_a Integer
118
+ expect(ps.size).to eq 23
95
119
  end
96
120
 
97
121
  it "not given and not defined options should be nil" do
98
122
  ps = CLI.new do
99
123
  option :size, :cast => Integer
100
124
  end.parse([])
101
- ps.size.should be_nil
102
- ps.gold.should be_nil
125
+ expect(ps.size).to be_nil
126
+ expect(ps.gold).to be_nil
103
127
  end
104
128
 
105
129
  it "not given option that can be specified multiple times should be an empty array" do
106
130
  ps = CLI.new do
107
131
  options :size, :cast => Integer
108
132
  end.parse([])
109
- ps.size.should == []
133
+ expect(ps.size).to eq []
110
134
  end
111
135
 
112
136
  it "should handle multiple long and short intermixed options" do
@@ -118,62 +142,62 @@ describe CLI do
118
142
  option :not_given
119
143
  option :size
120
144
  end.parse(['-l', 'singapore', '--power-up', 'yes', '-s', '24', '--size', 'XXXL'])
121
- ps.group.should == 'red'
122
- ps.power_up.should == 'yes'
123
- ps.speed.should == 24
124
- ps.not_given.should be_nil
125
- ps.size.should == 'XXXL'
126
- ps.gold.should be_nil
145
+ expect(ps.group).to eq 'red'
146
+ expect(ps.power_up).to eq 'yes'
147
+ expect(ps.speed).to eq 24
148
+ expect(ps.not_given).to be_nil
149
+ expect(ps.size).to eq 'XXXL'
150
+ expect(ps.gold).to be_nil
127
151
  end
128
152
 
129
153
  it "should support options that can be specified multiple times" do
130
154
  ps = CLI.new do
131
155
  options :power_up, :short => :p
132
156
  end.parse(['--power-up', 'fire'])
133
- ps.power_up.should == ['fire']
157
+ expect(ps.power_up).to eq ['fire']
134
158
 
135
159
  ps = CLI.new do
136
160
  options :power_up, :short => :p
137
161
  end.parse(['--power-up', 'fire', '-p', 'water', '--power-up', 'air', '-p', 'ground'])
138
- ps.power_up.should == ['fire', 'water', 'air', 'ground']
162
+ expect(ps.power_up).to eq ['fire', 'water', 'air', 'ground']
139
163
  end
140
164
 
141
165
  it "should support options that can be specified multiple times can have single default" do
142
166
  ps = CLI.new do
143
167
  options :power_up, :short => :p, :default => 'fire'
144
168
  end.parse([])
145
- ps.power_up.should == ['fire']
169
+ expect(ps.power_up).to eq ['fire']
146
170
  end
147
171
 
148
172
  it "should support options that can be specified multiple times can have multiple defaults" do
149
173
  ps = CLI.new do
150
174
  options :power_up, :short => :p, :default => ['fire', 'air']
151
175
  end.parse([])
152
- ps.power_up.should == ['fire', 'air']
176
+ expect(ps.power_up).to eq ['fire', 'air']
153
177
  end
154
178
 
155
179
  it "should raise error if not symbol and optional hash is passed" do
156
- lambda {
180
+ expect {
157
181
  ps = CLI.new do
158
182
  option 'number'
159
183
  end
160
- }.should raise_error CLI::ParserError::NameArgumetNotSymbolError, "option name has to be of type Symbol, got String"
184
+ }.to raise_error CLI::ParserError::NameArgumetNotSymbolError, "option name has to be of type Symbol, got String"
161
185
 
162
- lambda {
186
+ expect {
163
187
  ps = CLI.new do
164
188
  option :number, :test
165
189
  end
166
- }.should raise_error CLI::ParserError::OptionsArgumentNotHashError, "option options has to be of type Hash, got Symbol"
190
+ }.to raise_error CLI::ParserError::OptionsArgumentNotHashError, "option options has to be of type Hash, got Symbol"
167
191
  end
168
192
 
169
193
  it "should raise error on missing option argument" do
170
194
  ps = CLI.new do
171
195
  option :location
172
196
  end
173
-
174
- lambda {
197
+
198
+ expect {
175
199
  ps.parse(['--location'])
176
- }.should raise_error CLI::ParsingError::MissingOptionValueError, 'missing value for option --location'
200
+ }.to raise_error CLI::ParsingError::MissingOptionValueError, 'missing value for option --location'
177
201
  end
178
202
 
179
203
  it "should raise error on missing mandatory option" do
@@ -184,10 +208,10 @@ describe CLI do
184
208
  option :group, :default => 'red'
185
209
  option :speed, :short => :s, :cast => Integer
186
210
  end
187
-
188
- lambda {
211
+
212
+ expect {
189
213
  ps.parse([])
190
- }.should raise_error CLI::ParsingError::MandatoryOptionsNotSpecifiedError, "mandatory options not specified: --size, --weight"
214
+ }.to raise_error CLI::ParsingError::MandatoryOptionsNotSpecifiedError, "mandatory options not specified: --size, --weight"
191
215
  end
192
216
 
193
217
  it "by default option value should be nil" do
@@ -197,15 +221,14 @@ describe CLI do
197
221
  option :weight, :required => true
198
222
  option :group, :default => 'red'
199
223
  end
200
-
224
+
201
225
  o = ps.parse(['--weight', '123'])
202
226
 
203
- o.location.should be_nil
204
- o.speed.should be_nil
227
+ expect(o.location).to be_nil
228
+ expect(o.speed).to be_nil
205
229
 
206
- o.weight.should == '123'
207
- o.group.should == 'red'
230
+ expect(o.weight).to eq '123'
231
+ expect(o.group).to eq 'red'
208
232
  end
209
233
  end
210
234
  end
211
-
@@ -11,12 +11,12 @@ describe CLI do
11
11
  argument :test
12
12
  end.parse(['-l', 'singapore', '--debug', '--', '--verbose'])
13
13
 
14
- ps.help.should be_nil
15
- ps.location.should == 'singapore'
16
- ps.group.should == 'red'
17
- ps.debug.should be_true
18
- ps.test.should == '--verbose'
19
- ps.verbose.should be_nil
14
+ expect(ps.help).to be_nil
15
+ expect(ps.location).to eq 'singapore'
16
+ expect(ps.group).to eq 'red'
17
+ expect(ps.debug).to be true
18
+ expect(ps.test).to eq '--verbose'
19
+ expect(ps.verbose).to be_nil
20
20
 
21
21
  ps = CLI.new do
22
22
  option :location, :short => :l
@@ -26,11 +26,11 @@ describe CLI do
26
26
  argument :test
27
27
  end.parse(['-l', 'singapore', '--debug', '--help'])
28
28
 
29
- ps.location.should be_nil
30
- ps.group.should be_nil
31
- ps.debug.should be_nil
32
- ps.verbose.should be_nil
33
- ps.help.should_not be_nil
29
+ expect(ps.location).to be_nil
30
+ expect(ps.group).to be_nil
31
+ expect(ps.debug).to be_nil
32
+ expect(ps.verbose).to be_nil
33
+ expect(ps.help).not_to be_nil
34
34
 
35
35
  ps = CLI.new do
36
36
  option :location, :short => :l
@@ -43,15 +43,14 @@ describe CLI do
43
43
  argument :test3
44
44
  end.parse(['-l', 'singapore', '--debug', '--', '--help', '--version', '-m'])
45
45
 
46
- ps.help.should be_nil
47
- ps.location.should == 'singapore'
48
- ps.group.should == 'red'
49
- ps.debug.should be_true
50
- ps.test.should == '--help'
51
- ps.test2.should == '--version'
52
- ps.test3.should == '-m'
53
- ps.verbose.should be_nil
46
+ expect(ps.help).to be_nil
47
+ expect(ps.location).to eq 'singapore'
48
+ expect(ps.group).to eq 'red'
49
+ expect(ps.debug).to be true
50
+ expect(ps.test).to eq '--help'
51
+ expect(ps.test2).to eq '--version'
52
+ expect(ps.test3).to eq '-m'
53
+ expect(ps.verbose).to be_nil
54
54
  end
55
55
  end
56
56
  end
57
-
data/spec/stdin_spec.rb CHANGED
@@ -5,23 +5,23 @@ describe CLI do
5
5
  describe 'STDIN handling' do
6
6
  before :all do
7
7
  @yaml = <<EOF
8
- ---
9
- :parser:
8
+ ---
9
+ :parser:
10
10
  :successes: 41
11
11
  :failures: 0
12
12
  EOF
13
13
  end
14
14
 
15
15
  it "should be nil if not specified" do
16
- ps = CLI.new.parse
17
- ps.stdin.should be_nil
16
+ ps = CLI.new.parse([])
17
+ expect(ps.stdin).to be_nil
18
18
  end
19
19
 
20
20
  it "should return IO if stdin is defined" do
21
21
  ps = CLI.new do
22
22
  stdin
23
- end.parse
24
- ps.stdin.should be_a IO
23
+ end.parse([])
24
+ expect(ps.stdin).to be_a IO
25
25
  end
26
26
 
27
27
  it "should support casting to module responding to load" do
@@ -31,10 +31,10 @@ EOF
31
31
  end
32
32
 
33
33
  stdin_write(@yaml) do
34
- ps = ss.parse
34
+ ps = ss.parse([])
35
35
  end
36
36
 
37
- ps.stdin.should == {:parser=>{:successes=>41, :failures=>0}}
37
+ expect(ps.stdin).to eq({:parser=>{:successes=>41, :failures=>0}})
38
38
  end
39
39
 
40
40
  it "should support casting with lambda" do
@@ -44,10 +44,10 @@ EOF
44
44
  end
45
45
 
46
46
  stdin_write('hello world') do
47
- ps = ss.parse
47
+ ps = ss.parse([])
48
48
  end
49
49
 
50
- ps.stdin.should == 'HELLO WORLD'
50
+ expect(ps.stdin).to eq 'HELLO WORLD'
51
51
  end
52
52
 
53
53
  it "should support casting with custom class" do
@@ -64,12 +64,11 @@ EOF
64
64
  end
65
65
 
66
66
  stdin_write('hello world') do
67
- ps = ss.parse
67
+ ps = ss.parse([])
68
68
  end
69
69
 
70
- ps.stdin.should be_a Upcaser
71
- ps.stdin.value.should == 'HELLO WORLD'
70
+ expect(ps.stdin).to be_a Upcaser
71
+ expect(ps.stdin.value).to eq 'HELLO WORLD'
72
72
  end
73
73
  end
74
74
  end
75
-
data/spec/switch_spec.rb CHANGED
@@ -7,8 +7,8 @@ describe CLI do
7
7
  switch :location
8
8
  switch :unset
9
9
  end.parse(['--location'])
10
- ps.location.should be_true
11
- ps.unset.should be_nil
10
+ expect(ps.location).to be true
11
+ expect(ps.unset).to be_nil
12
12
  end
13
13
 
14
14
  it "should handle short switch names" do
@@ -16,47 +16,46 @@ describe CLI do
16
16
  switch :location, :short => :l
17
17
  switch :unset, :short => :u
18
18
  end.parse(['-l'])
19
- ps.location.should be_true
20
- ps.unset.should be_nil
19
+ expect(ps.location).to be true
20
+ expect(ps.unset).to be_nil
21
21
  end
22
22
 
23
23
  it "should raise error if not symbol and optional hash is passed" do
24
- lambda {
24
+ expect {
25
25
  ps = CLI.new do
26
26
  switch 'number'
27
27
  end.parse([])
28
- }.should raise_error CLI::ParserError::NameArgumetNotSymbolError, "switch name has to be of type Symbol, got String"
28
+ }.to raise_error CLI::ParserError::NameArgumetNotSymbolError, "switch name has to be of type Symbol, got String"
29
29
 
30
- lambda {
30
+ expect {
31
31
  ps = CLI.new do
32
32
  switch :number, :test
33
33
  end
34
- }.should raise_error CLI::ParserError::OptionsArgumentNotHashError, "switch options has to be of type Hash, got Symbol"
34
+ }.to raise_error CLI::ParserError::OptionsArgumentNotHashError, "switch options has to be of type Hash, got Symbol"
35
35
  end
36
36
 
37
37
  it "shoud raise error is short name is invalid" do
38
- lambda {
38
+ expect {
39
39
  ps = CLI.new do
40
40
  switch :location, :short => "l"
41
41
  end
42
- }.should raise_error CLI::ParserError::ShortNameNotSymbolError, 'short name for --location has to be of type Symbol, got String'
42
+ }.to raise_error CLI::ParserError::ShortNameNotSymbolError, 'short name for --location has to be of type Symbol, got String'
43
43
 
44
- lambda {
44
+ expect {
45
45
  ps = CLI.new do
46
46
  switch :location, :short => :abc
47
47
  end
48
- }.should raise_error CLI::ParserError::ShortNameIsInvalidError, 'short name for --location has to be one letter symbol, got :abc'
48
+ }.to raise_error CLI::ParserError::ShortNameIsInvalidError, 'short name for --location has to be one letter symbol, got :abc'
49
49
  end
50
50
 
51
51
  it "should raise error on unrecognized switch" do
52
52
  ps = CLI.new do
53
53
  option :location
54
54
  end
55
-
56
- lambda {
55
+
56
+ expect {
57
57
  ps.parse(['--xxx'])
58
- }.should raise_error CLI::ParsingError::UnknownSwitchError, 'unknown switch --xxx'
58
+ }.to raise_error CLI::ParsingError::UnknownSwitchError, 'unknown switch --xxx'
59
59
  end
60
60
  end
61
61
  end
62
-