Boolean with default value to false is nil

I have a migration that creates to boolean variables and set their
default value to false.
In a test I create an instance of this class but this variables are not
explicitly indicated so I though they should be set to false (default
value). Instead of this a test says that one variable is set to false
and the other to nil.
Do you know what is happening?

This is the test:
def test_invalid_null_name
nextaction = => “”,
:project_id => “1”,
:user_id => “1”)
assert !nextaction.valid?
assert nextaction.errors.invalid?(:name)
assert_equal nextaction.errors.length, 1
assert_equal nextaction.done, false
assert_equal nextaction.waitingfor, false
assert_equal nextaction.order, nil

and this is the part of the schema.rb refering to this table (I create
it with two migrations):

create_table “nextactions”, :force => true do |t|
t.string “name”
t.datetime “deadline”
t.integer “order”
t.integer “project_id”
t.integer “user_id”
t.datetime “created_at”
t.datetime “updated_at”
t.boolean “waitingfor”, :default => false
t.boolean “done”, :default => false

and this is the result when I execute the test:

Loaded suite nextaction_test
Finished in 0.525289 seconds.

  1. Failure:
    [nextaction_test.rb:14:in test_invalid_null_name' /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/testing/default.rb:7:inrun’]:
    expected but was

1 tests, 5 assertions, 1 failures, 0 errors

Try this:

t.boolean “waitingfor”, :default => false, :null => false
t.boolean “done”, :default => false, :null => false

On Mar 20, 10:05 am, Florencio C. [email protected]

You might consider this:

On Mar 22, 4:41 pm, Phillip K. [email protected]

The migration specifies how the column is defined in the database, not
in the object. When you do the, you are creating an
object but not a database record. If you save the object and reload it,
then test the bools, I’m thinking you’ll see your false values.