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 doing: Controller: def create @my_object = MyObject.new(:owner => params[:user_id]) @my_object.name = ''dog'' @my_object.save! end Test: def test_create_empty_object post :create, :user_id => ''sample_user'' assert_status 200 my_new_object = MyObject.find_by_owner(''sample_user'') puts my_new_object.id end 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? Thanks, Sean --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
As a follow up, is there a really good functional testing guide somewhere? Right now they feel pretty useless to me, as it looks like I can only test that I get a certain type of response from a request, rather than the controller method did what it was supposed to. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Try http://www.openqa.org/selenium/ selenium on http://www.randomhacks.net/articles/2006/02/15/selenium-on-rails-reloadedrails if you want more flexibility. Vish On 9/27/06, pico <pico303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > As a follow up, is there a really good functional testing guide > somewhere? Right now they feel pretty useless to me, as it looks like > I can only test that I get a certain type of response from a request, > rather than the controller method did what it was supposed to. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---