mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-01 05:01:04 -05:00
Previously, `rake spec` ran the tests whether or not the `growstuff_test` database existed or not, but `rake` crashed unless it had already been created. The problem was that `rake` was trying to load the environment, which required the presence of a DB; `rake spec` was running this with the `dev` environment, so succeeded if `growstuff_dev` existed, but `rake` was running everything with the `test` environment, so would fail if `growstuff_test` did not exist. This patch adds `db:create` to the dependencies of the `spec` task, forcing an unadorned `rake` to create all necessary databases first.
10 lines
198 B
Ruby
10 lines
198 B
Ruby
require 'rake'
|
|
begin
|
|
require 'rspec/core/rake_task'
|
|
task(:spec).clear
|
|
RSpec::Core::RakeTask.new(spec: ['db:create', 'db:test:prepare']) do |t|
|
|
t.verbose = false
|
|
end
|
|
rescue LoadError
|
|
end
|