guard-test 0.3.0.rc2 → 0.3.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,8 +7,7 @@ If you have any questions/issues about Guard or Guard::Test, please join us on o
7
7
  ## Features
8
8
 
9
9
  - Compatible with Test::Unit >= 2.2 and Minitest (Ruby 1.9).
10
- - Auto-detection of the `turn` gem (notification is still missing though).
11
- - Tested on Ruby 1.8.6, 1.8.7, 1.9.2, REE, Rubinius and JRuby.
10
+ - Tested on Ruby 1.8.7, 1.9.2, REE, Rubinius and JRuby.
12
11
 
13
12
  ## Install
14
13
 
@@ -86,7 +85,7 @@ Available options:
86
85
  :rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple Rubies, default: nil
87
86
  :bundler => false # don't use "bundle exec" to run the test command, default: true if a you have a Gemfile
88
87
  :runner => 'fastfail' # default: 'default'
89
- :cli => "-v" # pass arbitrary CLI arguments to the Ruby/Turn command that runs the tests, default: nil
88
+ :cli => "-v" # pass arbitrary CLI arguments to the Ruby command that runs the tests, default: nil
90
89
  :notification => false # don't display Growl (or Libnotify) notification after the specs are done running, default: true
91
90
  :all_on_start => false # don't run all the tests at startup, default: true
92
91
  :all_after_pass => false # don't run all tests after changed tests pass, default: true
@@ -26,11 +26,21 @@ module Guard
26
26
  end
27
27
 
28
28
  def rvm?
29
- @rvm ||= @options[:rvm] && @options[:rvm].respond_to?(:join)
29
+ if @rvm.nil?
30
+ @rvm = @options[:rvm] && @options[:rvm].respond_to?(:join)
31
+ end
32
+ @rvm
30
33
  end
31
34
 
32
35
  def turn?
33
- @turn ||= Object.const_defined?('Turn')
36
+ if @turn.nil?
37
+ @turn = begin
38
+ require 'turn'
39
+ rescue LoadError => ex
40
+ false
41
+ end
42
+ end
43
+ @turn
34
44
  end
35
45
 
36
46
  private
@@ -38,21 +48,20 @@ module Guard
38
48
  def test_unit_command(paths)
39
49
  cmd_parts = []
40
50
  cmd_parts << "rvm #{@options[:rvm].join(',')} exec" if rvm?
41
- cmd_parts << "bundle exec" if @options[:bundler]
42
- cmd_parts << "#{turn? ? 'turn' : 'ruby'} -Itest -rubygems"
43
- cmd_parts << "-r bundler/setup" if @options[:bundler]
51
+ cmd_parts << "bundle exec" if @options[:bundler] && !turn?
52
+ cmd_parts << "#{turn? ? 'turn' : 'ruby'} -Itest"
53
+ cmd_parts << "-r bundler/setup" if @options[:bundler] && !turn?
44
54
 
45
55
  unless turn?
46
56
  cmd_parts << "-r #{File.expand_path("../runners/#{@runner_name}_guard_test_runner", __FILE__)}"
47
57
  cmd_parts << "-e \"GUARD_TEST_NOTIFY=#{@options[:notification]}\""
48
58
  end
49
59
 
50
- paths.each { |path| cmd_parts << "-r ./#{path}" }
51
- cmd_parts << "--"
60
+ paths.each { |path| cmd_parts << "\"./#{path}\"" }
52
61
  cmd_parts << "--runner=guard-#{@runner_name}" unless turn?
53
- cmd_parts << @options[:cli] if @options[:cli]
62
+ cmd_parts << @options[:cli]
54
63
 
55
- cmd_parts.join(' ')
64
+ cmd_parts.compact.join(' ')
56
65
  end
57
66
 
58
67
  end