Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' into hook

Conflicts:
	lib/guard/guard.rb
	spec/guard_spec.rb
  • Loading branch information...
commit 5b8ae609da6c7627a17a92c30d4c903c22167ef2 2 parents 44aed32 + c0f1ea6
Rémy Coutable authored April 16, 2011
2  Guardfile
... ...
@@ -1,4 +1,4 @@
1  
-guard('rspec', :version => 2) do
  1
+guard('rspec', :cli => '-f doc', :version => 2) do
2 2
   watch(%r{^spec/(.*)_spec\.rb})
3 3
   watch(%r{^lib/(.*)\.rb})       { |m| "spec/#{m[1]}_spec.rb" }
4 4
   watch('spec/spec_helper.rb')   { "spec" }
9  lib/guard.rb
@@ -34,9 +34,7 @@ def start(options = {})
34 34
         UI.error "No guards found in Guardfile, please add at least one."
35 35
       else
36 36
         listener.on_change do |files|
37  
-          if Watcher.match_files?(guards, files)
38  
-            run { run_on_change_for_all_guards(files) }
39  
-          end
  37
+          run { run_on_change_for_all_guards(files) } if Watcher.match_files?(guards, files)
40 38
         end
41 39
 
42 40
         UI.info "Guard is now watching at '#{Dir.pwd}'"
@@ -50,11 +48,12 @@ def run_on_change_for_all_guards(files)
50 48
         paths = Watcher.match_files(guard, files)
51 49
         supervised_task(guard, :run_on_change, paths) unless paths.empty?
52 50
       end
  51
+
53 52
       # Reparse the whole directory to catch new files modified during the guards run
54 53
       new_modified_files = listener.modified_files([Dir.pwd + '/'], :all => true)
55 54
       listener.update_last_event
56 55
       unless new_modified_files.empty?
57  
-        run { run_on_change_for_all_guards(new_modified_files) }
  56
+        run { run_on_change_for_all_guards(new_modified_files) } if Watcher.match_files?(guards, files)
58 57
       end
59 58
     end
60 59
 
@@ -97,7 +96,7 @@ def get_guard_class(name)
97 96
     end
98 97
 
99 98
     def locate_guard(name)
100  
-      `gem which guard/#{name}`.chomp
  99
+      Gem.source_index.find_name("guard-#{name}").last.full_gem_path
101 100
     rescue
102 101
       UI.error "Could not find 'guard-#{name}' gem path."
103 102
     end
1  lib/guard/listener.rb
@@ -46,7 +46,6 @@ def recent_file?(file)
46 46
       false
47 47
     end
48 48
 
49  
-
50 49
     def self.mac?
51 50
       Config::CONFIG['target_os'] =~ /darwin/i
52 51
     end
17  spec/guard/dsl_spec.rb
... ...
@@ -1,5 +1,4 @@
1 1
 require 'spec_helper'
2  
-require 'guard/dsl'
3 2
 
4 3
 describe Guard::Dsl do
5 4
   subject { Guard::Dsl }
@@ -8,14 +7,14 @@
8 7
     ::Guard.stub!(:add_guard)
9 8
   end
10 9
 
11  
-  it "should write an error message when no Guardfile is found" do
  10
+  it "displays an error message when no Guardfile is found" do
12 11
     Dir.stub!(:pwd).and_return("no_guardfile_here")
13 12
 
14 13
     Guard::UI.should_receive(:error).with("No Guardfile in current folder, please create one.")
15 14
     lambda { subject.evaluate_guardfile }.should raise_error
16 15
   end
17 16
 
18  
-  it "should write an error message when Guardfile is not valid" do
  17
+  it "displays an error message when Guardfile is not valid" do
19 18
     mock_guardfile_content("This Guardfile is invalid!")
20 19
 
21 20
     Guard::UI.should_receive(:error).with(/Invalid Guardfile, original error is:\n/)
@@ -23,15 +22,23 @@
23 22
   end
24 23
 
25 24
   describe ".guardfile_include?" do
26  
-    it "should detect a guard specified as a string" do
  25
+    it "detects a guard specified by a string with simple quotes" do
27 26
       mock_guardfile_content("guard 'test'")
  27
+      subject.guardfile_include?('test').should be_true
  28
+    end
28 29
 
  30
+    it "detects a guard specified by a string with double quotes" do
  31
+      mock_guardfile_content('guard "test"')
29 32
       subject.guardfile_include?('test').should be_true
30 33
     end
31 34
 
32  
-    it "should detect a guard specified as a symbol" do
  35
+    it "detects a guard specified by a symbol" do
33 36
       mock_guardfile_content("guard :test")
  37
+      subject.guardfile_include?('test').should be_true
  38
+    end
34 39
 
  40
+    it "detects a guard wrapped in parentheses" do
  41
+      mock_guardfile_content("guard(:test)")
35 42
       subject.guardfile_include?('test').should be_true
36 43
     end
37 44
   end
12  spec/guard/listener_spec.rb
... ...
@@ -1,27 +1,27 @@
1 1
 require 'spec_helper'
2 2
 
3 3
 describe Guard::Listener do
4  
-  subject { described_class }
  4
+  subject { Guard::Listener }
5 5
 
6 6
   describe ".select_and_init" do
7 7
     before(:each) { @target_os = Config::CONFIG['target_os'] }
8 8
     after(:each) { Config::CONFIG['target_os'] = @target_os }
9 9
 
10  
-    it "should use darwin listener on Mac OS X" do
  10
+    it "uses darwin listener on Mac OS X" do
11 11
       Config::CONFIG['target_os'] = 'darwin10.4.0'
12 12
       Guard::Darwin.stub(:usable?).and_return(true)
13 13
       Guard::Darwin.should_receive(:new)
14 14
       subject.select_and_init
15 15
     end
16 16
 
17  
-    it "should use polling listener on Windows" do
  17
+    it "uses polling listener on Windows" do
18 18
       Config::CONFIG['target_os'] = 'win32'
19 19
       Guard::Polling.stub(:usable?).and_return(true)
20 20
       Guard::Polling.should_receive(:new)
21 21
       subject.select_and_init
22 22
     end
23 23
 
24  
-    it "should use linux listener on Linux" do
  24
+    it "uses linux listener on Linux" do
25 25
       Config::CONFIG['target_os'] = 'linux'
26 26
       Guard::Linux.stub(:usable?).and_return(true)
27 27
       Guard::Linux.should_receive(:new)
@@ -32,7 +32,7 @@
32 32
   describe "#update_last_event" do
33 33
     subject { described_class.new }
34 34
 
35  
-    it "should update last_event with time.now" do
  35
+    it "updates last_event with time.now" do
36 36
       time = Time.now
37 37
       subject.update_last_event
38 38
       subject.last_event.should >= time
@@ -40,4 +40,4 @@
40 40
 
41 41
   end
42 42
 
43  
-end
  43
+end
20  spec/guard/listeners/darwin_spec.rb
@@ -5,17 +5,17 @@
5 5
   subject { Guard::Darwin }
6 6
 
7 7
   if linux?
8  
-    it "should not be usable on linux" do
  8
+    it "isn't usable on linux" do
9 9
       subject.should_not be_usable
10 10
     end
11 11
   end
12 12
 
13 13
   if mac?
14  
-    it "should be usable on 10.6" do
  14
+    it "is usable on 10.6" do
15 15
       subject.should be_usable
16 16
     end
17 17
 
18  
-    describe "watch" do
  18
+    describe "#on_change" do
19 19
       before(:each) do
20 20
         @results = []
21 21
         @listener = Guard::Darwin.new
@@ -24,7 +24,7 @@
24 24
         end
25 25
       end
26 26
 
27  
-      it "should catch new file" do
  27
+      it "catches new file" do
28 28
         file = @fixture_path.join("newfile.rb")
29 29
         File.exists?(file).should be_false
30 30
         start
@@ -34,7 +34,7 @@
34 34
         @results.should == ['spec/fixtures/newfile.rb']
35 35
       end
36 36
 
37  
-      it "should catch file update" do
  37
+      it "catches file update" do
38 38
         file = @fixture_path.join("folder1/file1.txt")
39 39
         File.exists?(file).should be_true
40 40
         start
@@ -43,7 +43,7 @@
43 43
         @results.should == ['spec/fixtures/folder1/file1.txt']
44 44
       end
45 45
 
46  
-      it "should catch files update" do
  46
+      it "catches files update" do
47 47
         file1 = @fixture_path.join("folder1/file1.txt")
48 48
         file2 = @fixture_path.join("folder1/folder2/file2.txt")
49 49
         File.exists?(file1).should be_true
@@ -60,14 +60,14 @@
60 60
 private
61 61
 
62 62
   def start
63  
-    sleep 1
  63
+    sleep 0.6
64 64
     Thread.new { @listener.start }
65  
-    sleep 1
  65
+    sleep 0.6
66 66
   end
67 67
 
68 68
   def stop
69  
-    sleep 1
  69
+    sleep 0.6
70 70
     @listener.stop
71 71
   end
72 72
 
73  
-end
  73
+end
10  spec/guard/listeners/linux_spec.rb
@@ -6,17 +6,17 @@
6 6
   subject { Guard::Linux }
7 7
 
8 8
   if mac?
9  
-    it "should not be usable on 10.6" do
  9
+    it "isn't usable on 10.6" do
10 10
       subject.should_not be_usable
11 11
     end
12 12
   end
13 13
 
14 14
   if linux?
15  
-    it "should be usable on linux" do
  15
+    it "is usable on linux" do
16 16
       subject.should be_usable
17 17
     end
18 18
 
19  
-    describe "start" do
  19
+    describe "#start" do
20 20
       before(:each) do
21 21
         @listener = Guard::Linux.new
22 22
       end
@@ -40,7 +40,7 @@
40 40
 
41 41
     end
42 42
 
43  
-    describe "watch" do
  43
+    describe "#on_change" do
44 44
       before(:each) do
45 45
         @results = []
46 46
         @listener = Guard::Linux.new
@@ -127,4 +127,4 @@ def stop
127 127
     sleep 1
128 128
   end
129 129
 
130  
-end
  130
+end
58  spec/guard/listeners/polling_spec.rb
@@ -11,35 +11,37 @@
11 11
     end
12 12
   end
13 13
 
14  
-  it "should catch new file" do
15  
-    file = @fixture_path.join("newfile.rb")
16  
-    File.exists?(file).should be_false
17  
-    start
18  
-    FileUtils.touch file
19  
-    stop
20  
-    File.delete file
21  
-    @results.should == ['spec/fixtures/newfile.rb']
22  
-  end
  14
+  describe "#on_change" do
  15
+    it "catches new file" do
  16
+      file = @fixture_path.join("newfile.rb")
  17
+      File.exists?(file).should be_false
  18
+      start
  19
+      FileUtils.touch file
  20
+      stop
  21
+      File.delete file
  22
+      @results.should == ['spec/fixtures/newfile.rb']
  23
+    end
23 24
 
24  
-  it "should catch file update" do
25  
-    file = @fixture_path.join("folder1/file1.txt")
26  
-    File.exists?(file).should be_true
27  
-    start
28  
-    FileUtils.touch file
29  
-    stop
30  
-    @results.should == ['spec/fixtures/folder1/file1.txt']
31  
-  end
  25
+    it "catches file update" do
  26
+      file = @fixture_path.join("folder1/file1.txt")
  27
+      File.exists?(file).should be_true
  28
+      start
  29
+      FileUtils.touch file
  30
+      stop
  31
+      @results.should == ['spec/fixtures/folder1/file1.txt']
  32
+    end
32 33
 
33  
-  it "should catch files update" do
34  
-    file1 = @fixture_path.join("folder1/file1.txt")
35  
-    file2 = @fixture_path.join("folder1/folder2/file2.txt")
36  
-    File.exists?(file1).should be_true
37  
-    File.exists?(file2).should be_true
38  
-    start
39  
-    FileUtils.touch file1
40  
-    FileUtils.touch file2
41  
-    stop
42  
-    @results.sort.should == ['spec/fixtures/folder1/file1.txt', 'spec/fixtures/folder1/folder2/file2.txt']
  34
+    it "catches files update" do
  35
+      file1 = @fixture_path.join("folder1/file1.txt")
  36
+      file2 = @fixture_path.join("folder1/folder2/file2.txt")
  37
+      File.exists?(file1).should be_true
  38
+      File.exists?(file2).should be_true
  39
+      start
  40
+      FileUtils.touch file1
  41
+      FileUtils.touch file2
  42
+      stop
  43
+      @results.sort.should == ['spec/fixtures/folder1/file1.txt', 'spec/fixtures/folder1/folder2/file2.txt']
  44
+    end
43 45
   end
44 46
 
45 47
 private
@@ -54,4 +56,4 @@ def stop
54 56
     @listener.stop
55 57
   end
56 58
 
57  
-end
  59
+end
21  spec/guard/notifier_spec.rb
@@ -3,12 +3,15 @@
3 3
 describe Guard::Notifier do
4 4
   subject { Guard::Notifier }
5 5
 
6  
-  describe "notify" do
7  
-    before(:each) { ENV["GUARD_ENV"] = 'special_test' }
  6
+  describe ".notify" do
  7
+    before(:each) do
  8
+      @saved_guard_env = ENV["GUARD_ENV"]
  9
+      ENV["GUARD_ENV"] = 'dont_mute_notify'
  10
+    end
8 11
 
9 12
     if mac?
10 13
       require 'growl'
11  
-      it "should use Growl on Mac OS X" do
  14
+      it "uses Growl on Mac OS X" do
12 15
         Growl.should_receive(:notify).with("great",
13 16
           :title => "Guard",
14 17
           :icon  => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
@@ -20,7 +23,7 @@
20 23
 
21 24
     if linux?
22 25
       require 'libnotify'
23  
-      it "should use Libnotify on Linux" do
  26
+      it "uses Libnotify on Linux" do
24 27
         Libnotify.should_receive(:show).with(
25 28
           :body      => "great",
26 29
           :summary   => 'Guard',
@@ -30,12 +33,12 @@
30 33
       end
31 34
     end
32 35
 
33  
-    context "turned off" do
  36
+    describe ".turn_off" do
34 37
       before(:each) { subject.turn_off }
35 38
 
36 39
       if mac?
37 40
         require 'growl'
38  
-        it "should do nothing" do
  41
+        it "does nothing" do
39 42
           Growl.should_not_receive(:notify)
40 43
           subject.notify 'great', :title => 'Guard'
41 44
         end
@@ -43,14 +46,14 @@
43 46
 
44 47
       if linux?
45 48
         require 'libnotify'
46  
-        it "should do nothing" do
  49
+        it "does nothing" do
47 50
           Libnotify.should_not_receive(:show)
48 51
           subject.notify 'great', :title => 'Guard'
49 52
         end
50 53
       end
51 54
     end
52 55
 
53  
-    after(:each) { ENV["GUARD_ENV"] = 'test' }
  56
+    after(:each) { ENV["GUARD_ENV"] = @saved_guard_env }
54 57
   end
55 58
 
56  
-end
  59
+end
92  spec/guard/watcher_spec.rb
@@ -2,62 +2,66 @@
2 2
 require 'guard/guard'
3 3
 
4 4
 describe Guard::Watcher do
5  
-  
6  
-  describe "pattern" do
7  
-    it "should be required" do
8  
-      expect { Guard::Watcher.new }.to raise_error(ArgumentError)
9  
-    end
10  
-    
11  
-    it "can be a string" do
12  
-      Guard::Watcher.new('spec_helper.rb').pattern.should == 'spec_helper.rb'
13  
-    end
14  
-    
15  
-    it "can be a regexp" do
16  
-      Guard::Watcher.new(/spec_helper\.rb/).pattern.should == /spec_helper\.rb/
17  
-    end
18  
-    
19  
-    describe "string looking like a regex" do
20  
-      before(:each) { Guard::UI.should_receive(:info).any_number_of_times }
21  
-      
22  
-      specify { Guard::Watcher.new('^spec_helper.rb').pattern.should == /^spec_helper.rb/ }
23  
-      specify { Guard::Watcher.new('spec_helper.rb$').pattern.should == /spec_helper.rb$/ }
24  
-      specify { Guard::Watcher.new('spec_helper\.rb').pattern.should == /spec_helper\.rb/ }
25  
-      specify { Guard::Watcher.new('.*_spec.rb').pattern.should == /.*_spec.rb/ }
  5
+
  6
+  describe "#initialize" do
  7
+    describe "pattern parameter" do
  8
+      it "is required" do
  9
+        expect { Guard::Watcher.new }.to raise_error(ArgumentError)
  10
+      end
  11
+
  12
+      it "can be a string" do
  13
+        Guard::Watcher.new('spec_helper.rb').pattern.should == 'spec_helper.rb'
  14
+      end
  15
+
  16
+      it "can be a regexp" do
  17
+        Guard::Watcher.new(/spec_helper\.rb/).pattern.should == /spec_helper\.rb/
  18
+      end
  19
+
  20
+      describe "can be a string looking like a regex (deprecated)" do
  21
+        before(:each) { Guard::UI.should_receive(:info).any_number_of_times }
  22
+
  23
+        it "and is automatically casted to a regex" do
  24
+          Guard::Watcher.new('^spec_helper.rb').pattern.should == /^spec_helper.rb/
  25
+          Guard::Watcher.new('spec_helper.rb$').pattern.should == /spec_helper.rb$/
  26
+          Guard::Watcher.new('spec_helper\.rb').pattern.should == /spec_helper\.rb/
  27
+          Guard::Watcher.new('.*_spec.rb').pattern.should == /.*_spec.rb/
  28
+        end
  29
+      end
26 30
     end
27 31
   end
28  
-  
  32
+
29 33
   describe "action" do
30 34
     it "should set action to nil by default" do
31 35
       Guard::Watcher.new(/spec_helper\.rb/).action.should be_nil
32 36
     end
33  
-    
  37
+
34 38
     it "should set action with a block" do
35 39
       action = lambda { |m| "spec/#{m[1]}_spec.rb" }
36 40
       Guard::Watcher.new(%r{^lib/(.*).rb}, action).action.should == action
37 41
     end
38 42
   end
39  
-  
  43
+
40 44
   describe ".match_files" do
41 45
     before(:all) { @guard = Guard::Guard.new }
42  
-    
  46
+
43 47
     describe "a watcher's with no action" do
44 48
       context "regex pattern" do
45 49
         before(:all) { @guard.watchers = [Guard::Watcher.new(/.*_spec\.rb/)] }
46  
-        
  50
+
47 51
         it "should return paths as they came" do
48 52
           Guard::Watcher.match_files(@guard, ['guard_rocks_spec.rb']).should == ['guard_rocks_spec.rb']
49 53
         end
50 54
       end
51  
-      
  55
+
52 56
       context "string pattern" do
53 57
         before(:all) { @guard.watchers = [Guard::Watcher.new('guard_rocks_spec.rb')] }
54  
-        
  58
+
55 59
         it "should return paths as they came" do
56 60
           Guard::Watcher.match_files(@guard, ['guard_rocks_spec.rb']).should == ['guard_rocks_spec.rb']
57 61
         end
58 62
       end
59 63
     end
60  
-    
  64
+
61 65
     describe "a watcher's action with an arity equal to 0" do
62 66
       before(:all) do
63 67
         @guard.watchers = [
@@ -69,7 +73,7 @@
69 73
           Guard::Watcher.new(/^uptime\.rb/,    lambda { `uptime > /dev/null` })
70 74
         ]
71 75
       end
72  
-      
  76
+
73 77
       it "should return paths specified in the watcher's action" do
74 78
         Guard::Watcher.match_files(@guard, ['spec_helper.rb']).should == ['spec']
75 79
       end
@@ -89,7 +93,7 @@
89 93
         Guard::Watcher.match_files(@guard, ['uptime.rb']).should == []
90 94
       end
91 95
     end
92  
-    
  96
+
93 97
     describe "a watcher's action with an arity equal to 1" do
94 98
       before(:all) do
95 99
         @guard.watchers = [
@@ -101,7 +105,7 @@
101 105
           Guard::Watcher.new(/uptime(.*)\.rb/,   lambda { |m| `uptime > /dev/null` })
102 106
         ]
103 107
       end
104  
-      
  108
+
105 109
       it "should return paths after watcher's action has been called against them" do
106 110
         Guard::Watcher.match_files(@guard, ['lib/my_wonderful_lib.rb']).should == ['spec/my_wonderful_lib_spec.rb']
107 111
       end
@@ -121,56 +125,56 @@
121 125
         Guard::Watcher.match_files(@guard, ['uptime.rb']).should == []
122 126
       end
123 127
     end
124  
-    
  128
+
125 129
     describe "an exception is raised" do
126 130
       before(:all) { @guard.watchers = [Guard::Watcher.new('evil.rb', lambda { raise "EVIL" })] }
127  
-      
  131
+
128 132
       it "should display an error" do
129 133
         Guard::UI.should_receive(:error).with("Problem with watch action!")
130 134
         Guard::Watcher.match_files(@guard, ['evil.rb'])
131 135
       end
132 136
     end
133 137
   end
134  
-  
  138
+
135 139
   describe ".match_files?" do
136 140
     before(:all) do
137 141
       @guard1 = Guard::Guard.new([Guard::Watcher.new(/.*_spec\.rb/)])
138 142
       @guard2 = Guard::Guard.new([Guard::Watcher.new('spec_helper.rb', 'spec')])
139 143
       @guards = [@guard1, @guard2]
140 144
     end
141  
-    
  145
+
142 146
     describe "with at least on watcher that match a file given" do
143 147
       specify { Guard::Watcher.match_files?(@guards, ['lib/my_wonderful_lib.rb', 'guard_rocks_spec.rb']).should be_true }
144 148
     end
145  
-    
  149
+
146 150
     describe "with no watcher matching a file given" do
147 151
       specify { Guard::Watcher.match_files?(@guards, ['lib/my_wonderful_lib.rb']).should be_false }
148 152
     end
149 153
   end
150  
-  
  154
+
151 155
   describe "#match_file?" do
152 156
     describe "string pattern" do
153 157
       describe "normal string" do
154 158
         subject { Guard::Watcher.new('guard_rocks_spec.rb') }
155  
-        
  159
+
156 160
         specify { subject.match_file?('lib/my_wonderful_lib.rb').should be_false }
157 161
         specify { subject.match_file?('guard_rocks_spec.rb').should be_true }
158 162
       end
159  
-      
  163
+
160 164
       describe "string representing a regexp converted (while deprecation is active)" do
161 165
         subject { Guard::Watcher.new('^guard_rocks_spec\.rb$') }
162  
-        
  166
+
163 167
         specify { subject.match_file?('lib/my_wonderful_lib.rb').should be_false }
164 168
         specify { subject.match_file?('guard_rocks_spec.rb').should be_true }
165 169
       end
166 170
     end
167  
-    
  171
+
168 172
     describe "regexp pattern" do
169 173
       subject { Guard::Watcher.new(/.*_spec\.rb/) }
170  
-      
  174
+
171 175
       specify { subject.match_file?('lib/my_wonderful_lib.rb').should be_false }
172 176
       specify { subject.match_file?('guard_rocks_spec.rb').should be_true }
173 177
     end
174 178
   end
175  
-  
  179
+
176 180
 end
17  spec/guard_spec.rb
@@ -44,7 +44,7 @@
44 44
     end
45 45
 
46 46
     describe ".locate_guard" do
47  
-      it "should return guard-rspec gem path" do
  47
+      it "returns guard-rspec gem path" do
48 48
         guard_path = Guard.locate_guard('rspec')
49 49
         guard_path.should match(/^.*\/guard-rspec-.*$/)
50 50
         guard_path.should == guard_path.chomp
@@ -64,15 +64,15 @@
64 64
           @g.stub!(:regular_with_arg).with("given_path") { "i'm a success" }
65 65
         end
66 66
 
67  
-        it "should not fire the guard with a supervised method without argument" do
  67
+        it "doesn't fire the guard with a supervised method without argument" do
68 68
           lambda { subject.supervised_task(@g, :regular) }.should_not change(subject.guards, :size)
69 69
         end
70 70
 
71  
-        it "should not fire the guard with a supervised method with argument" do
  71
+        it "doesn't fire the guard with a supervised method with argument" do
72 72
           lambda { subject.supervised_task(@g, :regular_with_arg, "given_path") }.should_not change(subject.guards, :size)
73 73
         end
74 74
 
75  
-        it "should return the result of the supervised method" do
  75
+        it "returns the result of the supervised method" do
76 76
           ::Guard.supervised_task(@g, :regular).should be_true
77 77
           ::Guard.supervised_task(@g, :regular_with_arg, "given_path").should == "i'm a success"
78 78
         end
@@ -87,12 +87,12 @@
87 87
       describe "tasks that raise an exception" do
88 88
         before(:each) { @g.stub!(:failing) { raise "I break your system" } }
89 89
 
90  
-        it "should fire the guard" do
  90
+        it "fires the guard" do
91 91
           lambda { subject.supervised_task(@g, :failing) }.should change(subject.guards, :size).by(-1)
92 92
           subject.guards.should_not include(@g)
93 93
         end
94 94
 
95  
-        it "should return the exception object" do
  95
+        it "returns the exception object" do
96 96
           failing_result = ::Guard.supervised_task(@g, :failing)
97 97
           failing_result.should be_kind_of(Exception)
98 98
           failing_result.message.should == 'I break your system'
@@ -106,6 +106,11 @@
106 106
       end
107 107
     end
108 108
 
  109
+    describe ".locate_guard" do
  110
+      it "returns the path of the guard gem" do
  111
+        Guard.locate_guard('rspec').should == Gem.source_index.find_name("guard-rspec").last.full_gem_path
  112
+      end
  113
+    end
109 114
   end
110 115
 
111 116
 end
8  spec/spec_helper.rb
@@ -10,12 +10,12 @@
10 10
 
11 11
 RSpec.configure do |config|
12 12
   config.color_enabled = true
13  
-  
  13
+
14 14
   config.filter_run :focus => true
15 15
   config.run_all_when_everything_filtered = true
16  
-  
  16
+
17 17
   config.before(:each) do
18 18
     @fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
19 19
   end
20  
-  
21  
-end
  20
+
  21
+end

0 notes on commit 5b8ae60

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