【发布时间】:2013-08-23 08:54:12
【问题描述】:
我正在使用 RSpec 和 Guard 来测试我的 rails 应用程序。
一切正常,但如果没有设置环境变量,我有一些标签会被忽略。
例如:
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.include FactoryGirl::Syntax::Methods
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run focus: true
config.run_all_when_everything_filtered = true
config.filter_run_excluding :slow unless ENV["SLOW_SPECS"]
end
所以标记为 :slow 的规范只会在我的环境中 SLOW_SPECS=1 时运行
如何在不重新启动保护的情况下更改此值?
【问题讨论】:
-
如果我正确理解您的问题,
ENV["SLOW_SPECS"] = nil在运行时应该可以工作。 -
谢谢@Dolphin。不过,我希望在 Gaurd 中更改该环境变量 - 因为我不相信更改会在多个终端窗口中进行,而且我不想在更改过滤器时退出警戒
-
我也很想知道这一点。
标签: ruby-on-rails rspec guard