Hi all,

I want to test my controller, but unfortunately the model that has
association to other model. I already have setup the parameter in the
test code but encounter this error:
  1) Error:
test_create(SprintsControllerTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException:
sprints.project_id may not be NULL: INSERT
INTO "sprints"
("cancelled_date", "created_at", "end_date", "goal", "project_id",
"retrospective", "start_date", "updated_at")
VALUES (NULL, '2009-11-21 00:37:33.924413', '1901-01-01', 'Deliver
usable product', NULL, NULL, '1900-01-01', '2009-11-21
00:37:33.924413')

This is how my test code looks like:
assert_difference('Sprint.count') do
      post(:create, :sprint => {:project_id => '9999', :goal =>
'Deliver usable product',
                                :start_date => '1900-01-01', :end_date
=> '1901-01-01'})
    end

Have I setup the test code wrong? What am I missing here?

Thanks for the insights.

-- 
Certified Scrum Master
http://blog.scrum8.com | http://jobs.scrum8.com | http://twitter.com/scrum8

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=.


Reply via email to