@@ -94,7 +94,7 @@ errors_command = TestErrorsCommand.new
9494
9595describe Cling ::Command do
9696 it " executes the pre_run only" do
97- arguments_command.execute %w( --skip)
97+ arguments_command.execute( " --skip" ).should eq 0
9898 end
9999
100100 it " fails on missing arguments" do
@@ -104,13 +104,13 @@ describe Cling::Command do
104104 end
105105
106106 it " executes without errors" do
107- arguments_command.execute %w( foo bar)
108- arguments_command.execute %w( foo bar baz qux)
107+ arguments_command.execute( " foo bar" ).should eq 0
108+ arguments_command.execute( " foo bar baz qux" ).should eq 0
109109 end
110110
111111 it " fails on unknown values" do
112112 expect_raises Cling ::ValueNotFound do
113- arguments_command.execute %w( foo)
113+ arguments_command.execute " foo"
114114 end
115115 end
116116
@@ -121,18 +121,18 @@ describe Cling::Command do
121121 end
122122
123123 it " executes without errors" do
124- options_command.execute %w( --double-foo --bar=true)
124+ options_command.execute( " --double-foo --bar=true" ).should eq 0
125125 end
126126
127127 it " fails on unknown options" do
128128 expect_raises Cling ::CommandError do
129- options_command.execute %w( --double-foo --double-bar)
129+ options_command.execute " --double-foo --double-bar"
130130 end
131131 end
132132
133133 it " fails on invalid options" do
134134 expect_raises Cling ::CommandError do
135- options_command.execute %w( --foo=true --double-foo)
135+ options_command.execute " --foo=true --double-foo"
136136 end
137137
138138 expect_raises Cling ::CommandError do
@@ -143,45 +143,44 @@ describe Cling::Command do
143143 it " catches missing required arguments" do
144144 io = IO ::Memory .new
145145 hooks_command.stderr = io
146- hooks_command.execute " --double-foo"
147146
147+ hooks_command.execute(" --double-foo" ).should eq 0
148148 io.to_s.should eq " foo\n "
149149 end
150150
151151 it " catches unknown arguments" do
152152 io = IO ::Memory .new
153153 hooks_command.stderr = io
154- hooks_command.execute " foo --double-foo bar baz"
155154
155+ hooks_command.execute(" foo --double-foo bar baz" ).should eq 0
156156 io.to_s.should eq " bar, baz\n "
157157 end
158158
159159 it " catches an invalid option" do
160160 io = IO ::Memory .new
161161 hooks_command.stderr = io
162- hooks_command.execute " foo --double-foo=true\n "
163162
163+ hooks_command.execute(" foo --double-foo=true\n " ).should eq 1
164164 io.to_s.should eq " Option 'double-foo' takes no arguments\n "
165165 end
166166
167167 it " catches missing required values for options" do
168168 io = IO ::Memory .new
169169 hooks_command.stderr = io
170- hooks_command.execute " foo --double-foo --bar"
171170
171+ hooks_command.execute(" foo --double-foo --bar" ).should eq 1
172172 io.to_s.should eq " Missing required argument for option 'bar'\n "
173173
174174 io.rewind
175- hooks_command.execute " foo --double-foo -n"
176-
175+ hooks_command.execute(" foo --double-foo -n" ).should eq 1
177176 io.to_s.should eq " Missing required arguments for option 'num'\n "
178177 end
179178
180179 it " catches exceptions for program exit and other errors" do
181- errors_command.execute %w( --fail-fast)
180+ errors_command.execute( " --fail-fast" ).should eq 1
182181
183182 expect_raises(Exception , " failed slowly" ) do
184- errors_command.execute %w()
183+ errors_command.execute " "
185184 end
186185 end
187186end
0 commit comments