From abcc2c6edea587558bfb184287f5d9ee6cfc7bb8 Mon Sep 17 00:00:00 2001 From: Dan Pickett Date: Thu, 27 Sep 2012 17:49:08 -0400 Subject: [PATCH 1/3] zeus support with :zeus => true option --- README.md | 1 + lib/guard/rspec/runner.rb | 8 +++++++- spec/guard/rspec/runner_spec.rb | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 80e11e20..30aeb53f 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are deprecated an :run_all => { :cli => "-p" } # cli arguments to use when running all specs, default: same as :cli :spec_paths => ["spec"] # specify an array of paths that contain spec files :turnip => true # enable turnip support; default: false +:zeus => true # enable zeus support; default: false ``` You can also use a custom binstubs directory using `:binstubs => 'some-dir'`. diff --git a/lib/guard/rspec/runner.rb b/lib/guard/rspec/runner.rb index 473915ba..7ffe4ec7 100644 --- a/lib/guard/rspec/runner.rb +++ b/lib/guard/rspec/runner.rb @@ -14,7 +14,8 @@ def initialize(options = {}) :rvm => nil, :cli => nil, :notification => true, - :turnip => false + :turnip => false, + :zeus => false }.merge(options) deprecations_warnings @@ -98,6 +99,7 @@ def rspec_command(paths, options) cmd_parts = [] cmd_parts << "rvm #{@options[:rvm].join(',')} exec" if @options[:rvm].respond_to?(:join) cmd_parts << "bundle exec" if bundle_exec? + cmd_parts << 'zeus' if zeus? cmd_parts << rspec_executable cmd_parts << rspec_arguments(paths, options) cmd_parts.compact.join(' ') @@ -193,6 +195,10 @@ def binstubs? end end + def zeus? + @zeus = @options[:zeus].nil? ? false : @options[:zeus] + end + def binstubs if @options[:binstubs] == true "bin" diff --git a/spec/guard/rspec/runner_spec.rb b/spec/guard/rspec/runner_spec.rb index 2c557ee1..d5d627f2 100644 --- a/spec/guard/rspec/runner_spec.rb +++ b/spec/guard/rspec/runner_spec.rb @@ -202,6 +202,20 @@ end end + describe ':zeus' do + context ":zeus => true" do + subject { described_class.new(:zeus => true) } + + it 'runs with zeus' do + subject.should_receive(:system).with('bundle exec zeus rspec ' << + "-f progress -r #{@lib_path.join('guard/rspec/formatters/notification_rspec.rb')} " << + '-f Guard::RSpec::Formatter::NotificationRSpec --out /dev/null --failure-exit-code 2 spec' + ) + subject.run(['spec']) + end + end + end + describe ':cli' do context ":cli => '--color --drb --fail-fast'" do subject { described_class.new(:cli => '--color --drb --fail-fast') } From 306c210a90bceb0f6e9a83ebb258d3eed6a7bb2e Mon Sep 17 00:00:00 2001 From: Dan Pickett Date: Fri, 28 Sep 2012 06:46:37 -0400 Subject: [PATCH 2/3] simplify zeus option check --- lib/guard/rspec/runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/guard/rspec/runner.rb b/lib/guard/rspec/runner.rb index 7ffe4ec7..0d520b16 100644 --- a/lib/guard/rspec/runner.rb +++ b/lib/guard/rspec/runner.rb @@ -196,7 +196,7 @@ def binstubs? end def zeus? - @zeus = @options[:zeus].nil? ? false : @options[:zeus] + @zeus = @options[:zeus] || false end def binstubs From 376cae43fed92f88935665085e725b925ca448b1 Mon Sep 17 00:00:00 2001 From: Dan Pickett Date: Fri, 28 Sep 2012 08:18:04 -0400 Subject: [PATCH 3/3] drop unnecessary ivar --- lib/guard/rspec/runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/guard/rspec/runner.rb b/lib/guard/rspec/runner.rb index 0d520b16..f8010601 100644 --- a/lib/guard/rspec/runner.rb +++ b/lib/guard/rspec/runner.rb @@ -196,7 +196,7 @@ def binstubs? end def zeus? - @zeus = @options[:zeus] || false + @options[:zeus] || false end def binstubs