我正在使用 spork 来加快我的 RSpec 测试,但是我无法让它在每次运行时重新加载过滤条件,例如config.filter_run_excluding :slow => true
不管我是否将这些过滤器放入Spork.each_run
块中,它们似乎只在它第一次启动时才被加载,这很痛苦。
是否有可能让它们每次都被重新解释?
我的 spec_helper 文件:
require 'rubygems'
require 'spork'
require 'shoulda/integrations/rspec2'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'shared/test_macros'
require 'shared/custom_matchers'
require "email_spec"
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rspec
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.include(TestMacros)
end
end
Spork.each_run do
RSpec.configure do |config|
# THESE ONLY SEEM TO BE INTERPRETED DURING PRE-FORK
config.filter_run_excluding :slow => true
config.filter_run :now => true
end
end