File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ def parse_boolean(switch)
189
189
shift
190
190
false
191
191
else
192
- true
192
+ ! no_or_skip? ( switch )
193
193
end
194
194
else
195
195
@switches . key? ( switch ) || !no_or_skip? ( switch )
Original file line number Diff line number Diff line change @@ -349,6 +349,18 @@ def remaining
349
349
expect ( parse ( "--foo" , "bar" ) ) . to eq ( "foo" => true )
350
350
expect ( @opt . remaining ) . to eq ( %w( bar ) )
351
351
end
352
+
353
+ it "doesn't eat the next part of the param with 'no-opt' variant" do
354
+ create :foo => :boolean
355
+ expect ( parse ( "--no-foo" , "bar" ) ) . to eq ( "foo" => false )
356
+ expect ( @opt . remaining ) . to eq ( %w( bar ) )
357
+ end
358
+
359
+ it "doesn't eat the next part of the param with 'skip-opt' variant" do
360
+ create :foo => :boolean
361
+ expect ( parse ( "--skip-foo" , "bar" ) ) . to eq ( "foo" => false )
362
+ expect ( @opt . remaining ) . to eq ( %w( bar ) )
363
+ end
352
364
end
353
365
354
366
describe "with :hash type" do
You can’t perform that action at this time.
0 commit comments