Forum: Ruby on Rails about test database

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
daociyiyou (Guest)
on 2008-10-30 18:38
(Received via mailing list)
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?
Frederick C. (Guest)
on 2008-10-30 19:09
(Received via mailing list)
On 30 Oct 2008, at 16:37, daociyiyou wrote:

> ##########
> 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
daociyiyou (Guest)
on 2008-10-31 04:10
(Received via mailing list)
>
> 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.
daociyiyou (Guest)
on 2008-10-31 05:50
(Received via mailing list)
anyone help me?
Frederick C. (Guest)
on 2008-10-31 10:31
(Received via mailing list)
On Oct 31, 2:09 am, daociyiyou <removed_email_address@domain.invalid> wrote:
> 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
daociyiyou (Guest)
on 2008-10-31 14:00
(Received via mailing list)
On Oct 31, 4:31 pm, Frederick C. <removed_email_address@domain.invalid>
wrote:
> > 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


Thank you ,i have found the following words:[4;36;1mSQL (0.032000)
[0m    [0;1mROLLBACK [0m
This topic is locked and can not be replied to.