File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,8 @@ def validate_default_type!
127
127
@default . class . name . downcase . to_sym
128
128
end
129
129
130
- raise ArgumentError , "An option's default must match its type." unless default_type == @type
130
+ # TODO: This should raise an ArgumentError in a future version of Thor
131
+ warn "Expected #{ @type } default value for '#{ switch_name } '; got #{ @default . inspect } (#{ default_type } )" unless default_type == @type
131
132
end
132
133
133
134
def dasherized?
Original file line number Diff line number Diff line change @@ -135,9 +135,9 @@ def option(name, options = {})
135
135
end
136
136
137
137
it "raises an error if default is inconsistent with type" do
138
- expect do
139
- option ( "foo " , :type => :numeric , :default => "bar " )
140
- end . to raise_error ( ArgumentError , "An option's default must match its type." )
138
+ expect ( capture ( :stderr ) do
139
+ option ( "foo_bar " , :type => :numeric , :default => "baz " )
140
+ end . chomp ) . to eq ( 'Expected numeric default value for \'--foo-bar\'; got "baz" (string)' )
141
141
end
142
142
143
143
it "does not raises an error if default is an symbol and type string" do
You can’t perform that action at this time.
0 commit comments