Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

nil vs "" error in activerecord test

#2983

Fresh Rails checkout, this test fails with the following error: http://pastie.org/567717

1) Failure: test\_polymorphic\_assignment\_with\_primary\_key\_updates\_foreign\_id\_field\_for\_new\_and\_saved\_records(BelongsToAssociationsTest)<br/>

[./test/cases/associations/belongs_to_associations_test.rb:415:in 'test_polymorphic_assignment_with_primary_key_updates_foreign_id_field_for_new_and_saved_records'
 ./test/cases/../../lib/../../activemodel/lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in '__send__'
 ./test/cases/../../lib/../../activemodel/lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in 'run']:

expected but was
<"">.

My setup:

$ mysql --version

mysql Ver 14.12 Distrib 5.0.41, for apple-darwin8.11.1 (i686) using EditLine wrapper (MAMP)

$ sw_vers

ProductName: Mac OS X ProductVersion: 10.5.7<br/> BuildVersion: 9J61

Reported by Karl Doody · August 1st, 2009 @ 11:06 AM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Karl Doody
    Karl Doody

    mikeg1a on #railsbridge reports the same error, different test and setup though:

    test_nil_defaults_for_not_null_columns
    http://gist.github.com/159628

    mysql Ver 14.14 Distrib 5.1.28-rc, for apple-darwin9.4.0 (i686) using readline 5.1

    August 1st, 2009 @ 11:15 AM

  2. Zac Williams
    Zac Williams
    • Tag changed from 2.3.x, activerecord, active_record, fail, mysql, test to 2.3.x, activerecord, active_record, fail, mysql, patch, test

    In activerecord/test/schema/schema.rb you will see that the :name attribute in defined for the :authors has the :null => false property. I have corrected the test in the attached patch.

    August 4th, 2009 @ 04:15 AM

  3. Zac Williams
    Zac Williams
    • Tag changed from 2.3.x, activerecord, active_record, fail, mysql, patch, test to 2.3.x, activerecord, active_record, fail, mysql, patch, test, tested

    previously promised patch.

    August 4th, 2009 @ 04:16 AM

  4. Erik Ostrom
    Erik Ostrom

    Verified on mysql Ver 14.12 Distrib 5.0.45, for apple-darwin8.5.1 (i686) using readline 5.0

    With the current patch, the test succeeds on MySQL, but now it fails on SQLite3.

    August 9th, 2009 @ 10:01 PM

  5. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 6th, 2010 @ 06:47 AM