davetron5000/methadone — Issue #6: Set both symbol and string in options hash by default
Author: davetron5000
Created: 2011-11-01 02:28:48+00:00
State: open

```Ruby
test_that "omitting the block to opts sets the value in the options hash as both a string and a symbol " do
Given {
@switch, @negatable, @flag, @f, @other, @some_other = []
@switch_from_s @negatable_from_s @flag_from_s @f_from_s @other_from_s @some_other_from_s = []
main do
@switch = options[:switch]
@switch_from_s = options['switch']
@flag = options[:flag]
@flag_from_s = options['flag']
@f = options[:f]
@f_from_s = options['f]
@negatable = options[:negatable]
@negatable_from_s = options['negatable']
@other = options[:other]
@other_from_s = options['other']
@some_other = options[:some_other]
@some_other_from_s = options['some_other']
end

on("--switch")
on("--[no-]negatable")
on("--flag FLAG","-f","Some documentation string")
on("--other") do
options[:some_other] = true
end

set_argv %w(--switch --flag value --negatable --other)
}

When run_go_safely

Then {
@switch.should be true
@some_other.should be true
@other.should_not be true
@flag.should == 'value'
@f.should == 'value'
opts.to_s.should match /Some documentation string/

@switch_from_s.should be true
@some_other_from_s.should be true
@other_from_s.should_not be true
@flag_from_s.should == 'value'
@f_from_s.should == 'value'
}
end
```