On Fri, Dec 5, 2008 at 6:32 AM, Jeff Talbot <[EMAIL PROTECTED]> wrote:

> There is a seemingly very useful line of code in the cucumber wiki
> that I'd like to use:
>
>  After do
>    # Scenario teardown
>    Database.truncate_all
>  end
>

That's just an example of some code you might call in an After. A little
lower, you see

TempFileManager.clean_up

which also looks like non-Rails/Cucumber code.

A simple way to achieve the former would be

class Database
  def self.truncate
    TheModel.destroy_all
    TheOtherModel.destroy_all
    # etc
 end
end

destroy_all isn't exactly the same as SQL TRUNCATE, but it might serve your
purpose.

///ark
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to