File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 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!
127127 @default . class . name . downcase . to_sym
128128 end
129129
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
131132 end
132133
133134 def dasherized?
Original file line number Diff line number Diff line change @@ -135,9 +135,9 @@ def option(name, options = {})
135135 end
136136
137137 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)' )
141141 end
142142
143143 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