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