Skip to content

Commit

Permalink
Break the inline default spec command block into a method.
Browse files Browse the repository at this point in the history
I think that it's cleaner to have this glob of functionality in it's
own method rather than starting a new block halfway through the
function.

Signed-off-by: Sam Phippen <samphippen@googlemail.com>
  • Loading branch information
Sam Phippen committed Sep 13, 2012
1 parent 35eb45a commit 2538849
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/rspec/core/rake_task.rb
Expand Up @@ -164,18 +164,20 @@ def files_to_run
end

def spec_command
@spec_command ||= begin
cmd_parts = []
cmd_parts << RUBY
cmd_parts << ruby_opts
cmd_parts << "-w" if @warning
cmd_parts << "-S" << runner
cmd_parts << "-Ispec:lib" << rcov_opts if rcov
cmd_parts << files_to_run
cmd_parts << "--" if rcov && rspec_opts
cmd_parts << rspec_opts
cmd_parts.flatten.reject(&blank).join(" ")
end
@spec_command ||= default_spec_command
end

def default_spec_command
cmd_parts = []
cmd_parts << RUBY
cmd_parts << ruby_opts
cmd_parts << "-w" if @warning
cmd_parts << "-S" << runner
cmd_parts << "-Ispec:lib" << rcov_opts if rcov
cmd_parts << files_to_run
cmd_parts << "--" if rcov && rspec_opts
cmd_parts << rspec_opts
cmd_parts.flatten.reject(&blank).join(" ")
end

private
Expand Down

0 comments on commit 2538849

Please sign in to comment.