views:

30

answers:

1

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.

+1  A: 

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
Max Schulze
Tried it but still no luck, I figured out the initializers I have are the issue, I'm trying out preinitializer.rb in the config folder
nkassis
I mean this normally works for me, you can also put it into an initializer and have it run upon each load of the test environment.
Max Schulze