Hi, i want to use development database for my testing purpose. The problem is with, when test cases are run, it deletes the data before and after the test. but i dont want the data to be deleted. how to do this. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rajkumar Surabhi wrote:> Hi, > > i want to use development database for my testing purpose. > The problem is with, when test cases are run, it deletes the data before > and after the test. but i dont want the data to be deleted. > how to do this.Hi Rajkumar, You can duplicate your development database as testing database and specify the same in database.yml test environment. By doing this you will get the desired result without loosing data from development database. Thanks, Anubhaw -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Anubhaw Prakash wrote:> Rajkumar Surabhi wrote: >> Hi, >> >> i want to use development database for my testing purpose. >> The problem is with, when test cases are run, it deletes the data before >> and after the test. but i dont want the data to be deleted. >> how to do this. > > Hi Rajkumar, > You can duplicate your development database as testing database and > specify the same in database.yml test environment. By doing this you > will get the desired result without loosing data from development > database. > > Thanks, > AnubhawHi, But i don''t want to use seperate databases for testing and development . i need to use single database only.how to do this by using single database -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rajkumar Surabhi wrote:> Hi, > > i want to use development database for my testing purpose.No you don''t. The point of a test database is to have something that your tests can run against without messing with your dev data.> The problem is with, when test cases are run, it deletes the data before > and after the test. but i dont want the data to be deleted.Yes you do. Tests must start from a known state, or they will not be reliable.> how to do this.Don''t. It''s a terrible, horrible, dangerous idea. Don''t even consider it. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Marnen Laibow-Koser wrote: hi, May be but i need it to use single development database for both enviroments -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 17, 7:54 am, Rajkumar Surabhi <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> May be but i need it to use single development database for both > enviromentsWhy? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
stephenallred wrote:> On Aug 17, 7:54�am, Rajkumar Surabhi <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> May be but i need it to use single development database for both >> enviroments > > Why?Why indeed? That''s a BAD, DANGEROUS practice. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Rajkumar Surabhi wrote:> Marnen Laibow-Koser wrote: > > hi, > May be but i need it to use single development database for both > enviromentsRails makes the right things to do very easy, and if you stray outside that, well you made a conscious decision to go that route, and bear the consequences. You *are* using automated testing aren''t you? You *are* keeping your tests up to date with the code and data changes you make in your development database on an ongoing basis? You really need to look into some automated testing tools available for Rails to do this with any kind of replicability and efficiency. If you absolutely, positively, against-all-reason-and-recommendation have to use the same database for dev and test, I would still not do exactly that. I''d suggest you use sqlite for your development database, and copy your development.sqlite3 file to test.sqlite3 before running your tests, each and every time. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Take a look at some Rails testing resources - http://guides.rubyonrails.org/testing.html - take a look at the fixtures part. I can''t think of a reason not to have a separate testing database or to try and run tests on the dev db, unless you are trying to re-invent the wheel and make your own test suite. I think quite a few of us have had the experience of trying to build something, like unit tests, that have in place several standard solutions already. On Aug 17, 9:51 am, Ar Chron <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Rajkumar Surabhi wrote: > > Marnen Laibow-Koser wrote: > > > hi, > > May be but i need it to use single development database for both > > enviroments > > Rails makes the right things to do very easy, and if you stray outside > that, well you made a conscious decision to go that route, and bear the > consequences. > > You *are* using automated testing aren''t you? > > You *are* keeping your tests up to date with the code and data changes > you make in your development database on an ongoing basis? > > You really need to look into some automated testing tools available for > Rails to do this with any kind of replicability and efficiency. > > If you absolutely, positively, against-all-reason-and-recommendation > have to use the same database for dev and test, I would still not do > exactly that. > > I''d suggest you use sqlite for your development database, and copy your > development.sqlite3 file to test.sqlite3 before running your tests, each > and every time. > > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.