From 7cda54c2ef5d30960f9df6276d0acb338634352f Mon Sep 17 00:00:00 2001 From: Andreas Brandl <abrandl@gitlab.com> Date: Mon, 18 Nov 2019 09:11:14 +0100 Subject: [PATCH] Make spring a runtime option for Guard --- Guardfile | 5 +++-- doc/development/testing_guide/best_practices.md | 8 +------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Guardfile b/Guardfile index 668e761966f7..8a43f414ca9e 100644 --- a/Guardfile +++ b/Guardfile @@ -2,8 +2,9 @@ # More info at https://github.com/guard/guard#readme -# If using spring, change command to "spring rspec" -guard :rspec, cmd: "bundle exec rspec" do +cmd = ENV['SPRING'] ? 'spring rspec' : 'bundle exec rspec' + +guard :rspec, cmd: cmd do require "guard/rspec/dsl" dsl = Guard::RSpec::Dsl.new(self) diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 442de83de8a4..fe3989474e6a 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -50,13 +50,7 @@ Use [guard](https://github.com/guard/guard) to continuously monitor for changes bundle exec guard ``` -When using spring and guard together, consider adjusting Guardfile: - -```ruby -guard :rspec, cmd: "spring rspec" do - # ... -end -``` +When using spring and guard together, use `SPRING=1 bundle exec guard` instead to make use of spring. ### General guidelines -- GitLab