我使用带有Rails 3.1项目的测试单元gem,我有一个小问题。如果我开始执行rake任务,我总是会看到一个带有零的测试结果。
我的Gemfile是:
source :rubygems
gem 'rails', '3.1.2'
gem 'sqlite3'
gem 'json_pure'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
# gem 'sass-rails', '~> 3.1.5.rc.2'
# gem 'coffee-rails', '~> 3.1.1'
gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# Rails i18n
gem 'rails-i18n', :git => 'git://github.com/hron84/rails-i18n.git'
# Paginator
gem 'will_paginate'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
gem 'thin'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
group :development do
gem 'rails3-generators'
gem 'nifty-generators'
end
group :test do
gem 'rspec'
gem 'rspec-rails'
gem 'ci_reporter'
gem 'factory_girl'
unless defined? Rubinius
gem 'rcov'
gem 'rcov_rails'
gem 'test-unit'
end
gem 'ruby-prof'
gem 'faker'
end
# Application-related stuffs
gem 'authlogic'
# Slug helper
gem 'slug'
# vim: ft=Gemfile
有没有办法避免它?我做错了什么?
答案 0 :(得分:0)
检查您的RAILS_ENV。确保将其设置为"开发"而不是" test"。如果那不是罪魁祸首,请尝试逐个删除宝石(特别是与测试/规格相关的宝石),直到问题消失为止。然后你就会知道哪个宝石会给你带来问题。