我一直在使用rspec和guard來自動運行我的測試文件我保存文件,但守衛每次運行兩次,我不明白爲什麼,我在另一個帖子,這可能是因爲spec_helper.rb中有一個重複的配置選項,但我認爲不是我的情況。我離開我的spec_helper文件內容。希望知道如何解決這個問題,開始需要很長的時間來等待後衛運行兩次相同Rspec Guard始終運行兩次
感謝
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.include Devise::TestHelpers, type: :controller
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
config.include FactoryGirl::Syntax::Methods
config.before(:suite) do
FactoryGirl.lint
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.before(:all) do
DatabaseCleaner.start
end
config.before(:each) do
reset_email
end
config.after(:all) do
DatabaseCleaner.clean
end
config.include(MailerMacros)
config.include Rails.application.routes.url_helpers
end
移除
config.order = "random"
顯示您Guardfile爲好。它是否總是重複所有規格?或只有一些? – Doon 2014-10-28 18:53:59