Hey Jeremy, In the panel at RailsConf, you said that you don''t use fixtures but a copy of the production database instead. Can you elaborate on how you do tests this way (you also said it wasn''t that difficult ;) )? Thanks, Joe -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Joe Ruby <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> writes:> In the panel at RailsConf, you said that you don''t use fixtures but a > copy of the production database instead. Can you elaborate on how you do > tests this way (you also said it wasn''t that difficult ;) )? >http://media.pragprog.com/titles/fr_rr/code/CreateFixturesFromLiveData/lib/tasks/extract_fixtures.rake There is an ''extract_fixtures'' rake task, which will do that. HTH. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com Read my blog at: http://cuttingtheredtape.blogspot.com/ ,---- | "All animals are equal, but some animals are more equal than others." | -- Orwell, Animal Farm, 1945 `---- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8/30/06, Joe Ruby <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > In the panel at RailsConf, you said that you don''t use fixtures but a > copy of the production database instead. Can you elaborate on how you do > tests this way (you also said it wasn''t that difficult ;) )?Hi Joe. The basic idea: start with a test database full of fixtures and rely on transaction rollback between tests to keep the database clean. Remove all your fixtures :whatever lines from every test case. Use (clearer) @bob = Person.find_by_name(''bob'') instead of the (convenient) named accessor people(:bob). If you already have .yml fixtures in place and just want to ditch their declarations, then you can Rake::Task[''db:test:prepare''].enhance(''db:fixtures:load'') in lib/tasks/testing.rb. Then all fixtures are preloaded for all tests. If you want to ditch the tyranny of fixtures files also, create a ''pristine'' fixtures database and clone it to the test database whenever you modify it. In psql: createdb -T myapp_fixtures myapp_test Then use script/console fixtures (or a database browser) to create and modify. So, there''s not much to explain: stop using the fixtures feature; assume the data is there are ready to go. jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks guys! Joe -- 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-/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 -~----------~----~----~----~------~----~------~--~---