I have a Rails 2.2 app that I'm supporting and one thing that needs to be done before the开发者_StackOverflow中文版 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.
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
精彩评论