使用RSpec时删除rake测试?

时间:2014-01-01 20:24:46

标签: ruby-on-rails rspec

我在我的Rails应用程序中使用RSpec,但在执行rake -T时,我仍然获得默认的test rake任务:

rake spec             # Run all specs in spec directory (excluding plugin specs) / Run RSpec cod...
rake spec:controllers # Run the code examples in spec/controllers
rake spec:models      # Run the code examples in spec/models
rake spec:requests    # Run the code examples in spec/requests
rake spec:routing     # Run the code examples in spec/routing
rake stats            # Report code statistics (KLOCs, etc) from the application
rake test             # Runs test:units, test:functionals, test:integration together
rake test:all         # Run tests quickly by merging all types and not resetting db
rake test:all:db      # Run tests quickly, but also reset db

这是正常的吗?可以/我应该以某种方式删除它们吗?

1 个答案:

答案 0 :(得分:5)

转到您的config/application.rb文件&取代

require 'rails/all'

用这个:

# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"

注意,现在我们不再加载test_unit,因此它的rake任务不会被包含在内。