I obviously don’t fully understand functional testing. I’m trying to
test object creation, but I can’t get my functional test to actually
create an object with a unique ID. Here’s a rough outline of what I’m
@my_object = MyObject.new(:owner => params[:user_id])
@my_object.name = ‘dog’
post :create, :user_id => ‘sample_user’
my_new_object = MyObject.find_by_owner('sample_user') puts my_new_object.id
My question is: why does my_new_object come back with an ID of 0?
This really causes problems when I’m trying to relate new objects to
one another and somehow the functional tests keep setting the object
IDs to 0. Is there a way around this? Should I be testing this
functionality in another way?