Rails:运行Cucumber时出现Sqlite3相关错误

时间:2012-03-31 03:30:13

标签: ruby-on-rails sqlite cucumber gemfile

这是我的gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.2'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'


group :production do
  gem 'pg'
end


group :test, :development do
  gem 'mysql2'
  gem "cucumber-rails", "~> 1.3.0"
  gem "rspec-rails", "~> 2.9.0"
  gem "database_cleaner", "~> 0.7.2"
  gem "factory_girl", "~> 3.0.0"
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem "heroku"
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

我在Ruby 1.9.3-p125和Rails 3.2.2。

当我$ cucumber时,我收到以下错误:

Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError)

为什么我会收到此错误?我不想使用sqlite3 gem,我不知道为什么在启动黄瓜时我会得到它。我可以毫无问题地启动服务器......

1 个答案:

答案 0 :(得分:0)

可能是因为在config/database.yml文件中,测试环境以adapter: sqlite3的形式发出,请将其更改为adapter: mysql2。告诉我这不是问题。