大家好,我是黄瓜的新手,我有一个带有 mongoid 的应用程序。
我的Gemfile中有 database_cleaner
gem "database_cleaner", ">= 0.7.2", :group => :test
在我的app/features/support/env.rb
文件中,我有:
require 'cucumber/rails'
Capybara.default_selector = :css
ActionController::Base.allow_rescue = false
begin
DatabaseCleaner.orm = 'mongoid'
DatabaseCleaner.strategy = :truncation
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Cucumber::Rails::Database.javascript_strategy = :truncation
当我跑rake cucumber
我得到下一个错误:
uninitialized constant Cucumber::Rails::Database (NameError)
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library'
/home/ubuntu/Desktop/mf9/features/support/env.rb:59:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/bin/cucumber:23:in `load'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p125@rails32/bin/cucumber:23:in `<main>'
rake aborted!
Command failed with status (1): [/home/ubuntu/.rvm/rubies/ruby-1.9.3-p125/b...]