Forum: Ruby on Rails Delete the fixtures on a functionnal test

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2fd0206c71a1b22a9cc6293f38537461?d=identicon&s=25 cyril mougel (Guest)
on 2007-06-13 07:05
(Received via mailing list)

Since couple a day, I block with the delete of my fixtures in my
functionnals test. In my controller, I need test a redirect if there
are no value.

But i load my fixtures in start of my test and in a specific test I
want delete all. Only in this method, not in other method. In API, I
discover the method delete_existing_fixtures, who seem the good
practice, but I can't find how use it. I have always the information
of method not found.

So I want know if anyone has an information for delete my fixtures in
a test.


Cyril Mougel
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-06-14 05:31
(Received via mailing list)
cyril mougel wrote:

> So I want know if anyone has an information for delete my fixtures in
> a test.

This is just an ActiveRecord question. Given a model called Model, just
Model.destroy_all before the test case that needs to see no records.

Tip: Don't destroy every record in every model. Only destroy the exact
your tests need destroyed. If you change fixtures or behavior later in a
this test dislikes, it should fail, and that might stop you from making

  "Test Driven Ajax (on Rails)"
  assert_xpath, assert_javascript, & assert_ajax
This topic is locked and can not be replied to.