开发者

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

开发者 https://www.devze.com 2023-01-22 09:41 出处:网络
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

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
0

精彩评论

暂无评论...
验证码 换一张
取 消