在我的config/database.yml中使用Rails 3.2.6应用程序中的简单Rails sqlite3配置示例,我曾经重置我的开发数据库,重新播种它,并通过执行以下操作来准备我的测试数据库:
$ rake db:reset
$ rake db:test:prepare
Run Code Online (Sandbox Code Playgroud)
在看了这篇关于在不同的数据库引擎上用Travis CI测试Rails应用程序的博客文章后,我想我会尝试一下,所以我使用Homebrew安装了mysql和postgresql (我在OSX Snow Leopard上),设置它们按照brew info说明.我安装了相关的gem,并按如下方式配置了数据库和Travis文件:
的Gemfile
# ...
group :development, :test do
# ...
gem 'sqlite3', '1.3.6'
end
group :test do
# ...
# Test mysql on Travis CI
gem 'mysql2', '0.3.11'
end
group :test, :production do
# ...
# Test postgres on Travis CI and deploy on Heroku
gem 'pg', '0.13.2'
end
Run Code Online (Sandbox Code Playgroud)
配置/ database.yml的
sqlite: …Run Code Online (Sandbox Code Playgroud) rake ruby-on-rails ruby-on-rails-3 travis-ci ruby-on-rails-3.2
我有以下.travis.yml文件:
language: ruby
rvm:
- "2.0.0"
# uncomment this line if your project needs to run something other than `rake`:
before_script:
- psql -c "create database dummy_test;" -U postgres
- psql -c "CREATE USER dummy WITH PASSWORD 'dummy';" -U postgres
script:
- RAILS_ENV=test bundle exec rake db:migrate --trace
- bundle exec rake db:test:prepare
- bundle exec rspec spec
Run Code Online (Sandbox Code Playgroud)
当我尝试在Travis CI中运行它时,我收到以下错误消息:
$ RAILS_ENV=test bundle exec rake db:migrate --trace
rake aborted!
Don't know how to build task 'db:migrate'
Run Code Online (Sandbox Code Playgroud)
几个小时我一直在尝试不同的方法.我究竟做错了什么?