i have a conclusion to make sure,that is : when testing codes, only the fixtures data are stored in the test database table after running the test and the model saved during runing test method is not stored in the test database table? For example: ######### def test_save user=User.new(...) user.save end ########## After running the test method,the user is not stored in the test database table? right? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On 30 Oct 2008, at 16:37, daociyiyou wrote:> > i have a conclusion to make sure,that is : when testing codes, only > the fixtures data are stored in the test database table after running > the test and the model saved during runing test method is not stored > in the test database table? For example: > ######### > def test_save > user=User.new(...) > user.save > end > ########## > After running the test method,the user is not stored in the test > database table? > right?Sort of. It is stored in the test database, but the entire test runs within a transaction, which is rolled back at the end of the test. Fred --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
> > Sort of. It is stored in the test database, but the entire test runs > within a transaction, which is rolled back at the end of the test. > > FredBut rolled back at the end of this test method or the entire controller test? You means I need not consider if the user is saved in the test database table in the following test methods because the user is not in the database at that time? If the user is still in the database in the following test methods.i need to consider it because of my application’s logic. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
anyone help me? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 31, 2:09 am, daociyiyou <chey...-/E1597aS9LRv1O+Z8WTAqQ@public.gmane.org> wrote:> > Sort of. It is stored in the test database, but the entire test runs > > within a transaction, which is rolled back at the end of the test. > > > Fred > > But rolled back at the end of this test method or the entire > controller test? You means I need not consider if the user is saved in > the test database table in the following test methods because the user > is not in the database at that time? > If the user is still in the database in the following test methods.i > need to consider it because of my application’s logic.Take a look in your app''s test.log and you''ll see for yourself. Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 31, 4:31 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Oct 31, 2:09 am, daociyiyou <chey...-/E1597aS9LRv1O+Z8WTAqQ@public.gmane.org> wrote: > > > > Sort of. It is stored in the test database, but the entire test runs > > > within a transaction, which is rolled back at the end of the test. > > > > Fred > > > But rolled back at the end of this test method or the entire > > controller test? You means I need not consider if the user is saved in > > the test database table in the following test methods because the user > > is not in the database at that time? > > If the user is still in the database in the following test methods.i > > need to consider it because of my application’s logic. > > Take a look in your app''s test.log and you''ll see for yourself. > > FredThank you ,i have found the following words:[4;36;1mSQL (0.032000) [0m [0;1mROLLBACK [0m --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---