Skip to content
Browse files

Fixed for results displaying more than once when specifying a formatter

The modified line was not taking into account a :cli formatting option like this: '--format=documentation' because the .include? test compares the entire line and not just the '--format' option specifier.

This fix greps for the format specifier at the beginning of the string and will disregard the '=' sign and anything that follows.
  • Loading branch information...
1 parent f5b93ba commit 53cc1fa0f81e6cf436d3d75cca5068272841e153 Chris Blackburn committed Dec 29, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/guard/rspec/runner.rb
View
2 lib/guard/rspec/runner.rb
@@ -30,7 +30,7 @@ def rspec_command(paths, options={})
cmd_parts << "bundle exec" if (bundler? && options[:binstubs] == true && options[:bundler] != false) || (bundler? && options[:bundler] != false)
cmd_parts << rspec_exec(options)
cmd_parts << options[:cli] if options[:cli]
- cmd_parts << "-f progress" if options[:cli].nil? || !options[:cli].split(' ').any? { |w| %w[-f --format].include?(w) }
+ cmd_parts << "-f progress" if options[:cli].nil? || !options[:cli].split(' ').any? { |w| %w[-f --format].grep(/^#{w}/) }
cmd_parts << "-r #{File.dirname(__FILE__)}/formatters/notification_#{rspec_class.downcase}.rb -f Guard::RSpec::Formatter::Notification#{rspec_class}#{rspec_version == 1 ? ":" : " --out "}/dev/null" if options[:notification] != false
cmd_parts << "--failure-exit-code #{failure_exit_code}" if failure_exit_code_supported?(options)
cmd_parts << paths.join(' ')

0 comments on commit 53cc1fa

Please sign in to comment.
Something went wrong with that request. Please try again.