diff --git a/Guardfile b/Guardfile index 668e761966f7fec62a8d996f19bb595775b7ddaa..8a43f414ca9ecab21ffe9d0b50f1022489dd829f 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 442de83de8a4f825e93dea309870dc6e6d005ae4..fe3989474e6a6bee864ac598c9d5d21e7d80eaf7 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