Skip to content

Commit

Permalink
Merge pull request #181 from HotFusionMan/feature/run_all_parallel
Browse files Browse the repository at this point in the history
Added parallel option to run_all.
  • Loading branch information
thibaudgg committed May 27, 2013
2 parents cac4a6a + a841ef3 commit 9bae07a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are deprecated an
:all_after_pass => true # run all specs after changed specs pass, default: false
:all_on_start => true # run all the specs at startup, default: false
:keep_failed => true # keep failed specs until they pass, default: false
:run_all => { :cli => "-p" } # cli arguments to use when running all specs, default: same as :cli
:run_all => { :cli => "-p", :parallel => true, :parallel_cli => '-n 2' } # cli arguments to use when running all specs, default: same as :cli; parallel_rspec arguments, default: same as :parallel_cli
:spec_paths => ["spec"] # specify an array of paths that contain spec files
:exclude => "spec/foo/**/*" # exclude files based on glob
:spring => true # enable spring support; default: false
Expand Down
3 changes: 2 additions & 1 deletion lib/guard/rspec/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def zeus?
end

def parallel?
options.fetch(:parallel, false)
parallel = options.fetch(:parallel, false)
(run_all = options[:run_all]) ? (run_all[:parallel] || parallel) : parallel

This comment has been minimized.

Copy link
@HotFusionMan

HotFusionMan May 27, 2013

Contributor

I discovered just now while using this new feature that it isn't quite right -- I meant it to only run parallel_rspec during run_all, but it now always runs parallel_rspec. I'm working on a fix in my fork.

This comment has been minimized.

Copy link
@thibaudgg

thibaudgg May 27, 2013

Author Member

Ok thanks.

end

def spring?
Expand Down
15 changes: 15 additions & 0 deletions spec/guard/rspec/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,21 @@
end
end
end

describe ':run_all' do
context ':parallel => true' do
subject { described_class.new(:run_all => {:parallel => true}) }

it 'runs with parallel_rspec' do
subject.should_receive(:system).with(
'bundle exec parallel_rspec ' <<
"-o '-f progress -r /Users/achou/Workspace/guard-rspec/lib/guard/rspec/formatter.rb -f Guard::RSpec::Formatter --failure-exit-code 2' spec"
).and_return(true)

subject.run(['spec'])
end
end
end
end
end
end
Expand Down

0 comments on commit 9bae07a

Please sign in to comment.