@@ -253,25 +253,35 @@ def file
253
253
end
254
254
255
255
describe "#run" do
256
- before do
257
- expect ( runner ) . to receive ( :system ) . with ( "ls" )
258
- end
256
+ describe "when not pretending" do
257
+ before do
258
+ expect ( runner ) . to receive ( :system ) . with ( "ls" )
259
+ end
259
260
260
- it "executes the command given" do
261
- action :run , "ls"
262
- end
261
+ it "executes the command given" do
262
+ action :run , "ls"
263
+ end
263
264
264
- it "logs status" do
265
- expect ( action ( :run , "ls" ) ) . to eq ( " run ls from \" .\" \n " )
266
- end
265
+ it "logs status" do
266
+ expect ( action ( :run , "ls" ) ) . to eq ( " run ls from \" .\" \n " )
267
+ end
267
268
268
- it "does not log status if required" do
269
- expect ( action ( :run , "ls" , :verbose => false ) ) . to be_empty
269
+ it "does not log status if required" do
270
+ expect ( action ( :run , "ls" , :verbose => false ) ) . to be_empty
271
+ end
272
+
273
+ it "accepts a color as status" do
274
+ expect ( runner . shell ) . to receive ( :say_status ) . with ( :run , 'ls from "."' , :yellow )
275
+ action :run , "ls" , :verbose => :yellow
276
+ end
270
277
end
271
278
272
- it "accepts a color as status" do
273
- expect ( runner . shell ) . to receive ( :say_status ) . with ( :run , 'ls from "."' , :yellow )
274
- action :run , "ls" , :verbose => :yellow
279
+ describe "when pretending" do
280
+ it "doesn't execute the command" do
281
+ runner = MyCounter . new ( [ 1 ] , %w( --pretend ) )
282
+ expect ( runner ) . not_to receive ( :system )
283
+ runner . run ( "ls" , :verbose => false )
284
+ end
275
285
end
276
286
end
277
287
0 commit comments