nkassis
nkassis

Reputation: 5353

How to run a rake task right after rspec initializes the database

I have a Rails 2.2 app that I'm supporting and one thing that needs to be done before the app start is a small rake task to initialize and make sure the database is properly set. How can I get this task run right after rspec initializes the database. I run rspec using the rails spec command.

Upvotes: 1

Views: 1238

Answers (1)

Max Schulze
Max Schulze

Reputation: 1173

You could put a simple system call to your spec_helper.rb file.

An Example could look like this

# run rake task
`rake your_task RAILS_ENV=test`

RSpec.configure do |config|
  ...
end

Upvotes: 1

Related Questions