This project is archived and is in readonly mode.

#4622 ✓committed
Rohit Arondekar

Valid number pretending to be a invalid number in ActiveModel tests

Reported by Rohit Arondekar | May 17th, 2010 @ 05:09 AM | in 3.0.2

Running the ActiveModel testsuite in Rails master on ruby 1.9.2dev (2010-05-08 trunk 27665) [x86_64-linux] gives 3 failures.

2 failures are because of a number that's supposed to be bad but is actually good. I've made a patch that makes the number bad again, and will attach it in a comment.

The stacktrace:

1) Failure: test_default_validates_numericality_of(NumericalityValidationTest) [/home/rohit/remote-repos/rails_patches/working1/activemodel/test/cases/validations/numericality_validation_test.rb:166]:
"0xdeadbeef" not rejected as a number

2) Failure: test_validates_numericality_of_with_nil_allowed(NumericalityValidationTest) [/home/rohit/remote-repos/rails_patches/working1/activemodel/test/cases/validations/numericality_validation_test.rb:166]:
"0xdeadbeef" not rejected as a number

3) Failure: test_should_serialize_yaml(XmlSerializationTest) [/home/rohit/remote-repos/rails_patches/working1/activemodel/test/cases/serializeration/xml_serialization_test.rb:107]:
Expected /\n\n aaron stack\n

303 tests, 865 assertions, 3 failures, 0 errors, 0 skips

Test run options: --seed 11594
rake aborted!
Command failed with status (1): [/home/rohit/.rvm/rubies/ruby-1.9.2-head/bi...]

Failure 1 and 2 are because of the good number "0xdeadbeef" in the JUNK array in numericality_validation_test.rb Changing it to an invalid number like "0xdeadbeet" makes the test pass as expected. Patch will be provided in a comment.

P.S I don't know how to fix the 3rd failure.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages