@@ -239,11 +239,21 @@ class DefaultTest < ActiveRecord::Base
239239 end
240240
241241 it 'converts a 0, "false" false and nil to a boolean false, everything else is true' do
242+ # there is a bug someplace (unparser probably) that is is treating the empty array as nil
243+ # but ONLY if it is the normal ruby block (not a string) AND if you use a normal arg
244+ # instead of *args. In other words put that same expression in a string and change
245+ # *args/args.first to plain old arg and it works fine.
242246 expect_evaluate_ruby do
247+ [ 0 , 'false' , false , nil , 'hi' , 17 , [ ] , true ] . collect do |*args |
248+ TypeTest . new ( boolean : args . first ) . boolean
249+ end
250+ end . to eq ( [ false , false , false , false , true , true , true , true ] )
251+
252+ expect_evaluate_ruby ( "
243253 [0, 'false', false, nil, 'hi', 17, [], true].collect do |val|
244254 TypeTest.new(boolean: val).boolean
245255 end
246- end . to eq ( [ false , false , false , false , true , true , true , true ] )
256+ " ) . to eq ( [ false , false , false , false , true , true , true , true ] )
247257 check_errors
248258 end
249259
0 commit comments