Hi! 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 = Nextaction.new(:name => "", :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 end
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 end
and this is the result when I execute the test:
Loaded suite nextaction_test Started F Finished in 0.525289 seconds.
1) Failure: test_invalid_null_name(NextactionTest) [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:in `run']: <nil> expected but was <false>.
1 tests, 5 assertions, 1 failures, 0 errors