Permalink
Browse files

Change work dir to the `watchdir`.

  • Loading branch information...
1 parent f4e19a2 commit a6d739227da3f2232a58931041b45b71c749f520 @netzpirat netzpirat committed Mar 27, 2013
Showing with 10 additions and 1 deletion.
  1. +2 −1 CHANGELOG.md
  2. +2 −0 lib/guard.rb
  3. +6 −0 spec/guard_spec.rb
View
3 CHANGELOG.md
@@ -3,6 +3,7 @@
### Improvements
- [#400][] Drop dependency on `terminal-table` and use `formatador` instead. ([@netzpirat][])
+- Change the current work dir to the `watchdir`. ([@netzpirat][])
### Bug fixes
@@ -823,4 +824,4 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
[@waldo]: https://github.com/waldo
[@wereHamster]: https://github.com/wereHamster
[@yannlugrin]: https://github.com/yannlugrin
-[@zonque]: https://github.com/zonque
+[@zonque]: https://github.com/zonque
View
2 lib/guard.rb
@@ -51,6 +51,8 @@ def setup(options = {})
@runner = ::Guard::Runner.new
@scope = { :plugins => [], :groups => [] }
+ Dir.chdir(@watchdir)
+
if options[:debug]
Thread.abort_on_exception = true
::Guard::UI.options[:level] = :debug
View
6 spec/guard_spec.rb
@@ -3,6 +3,7 @@
describe Guard do
before do
::Guard::Interactor.stub(:fabricate)
+ Dir.stub(:chdir)
end
describe ".setup" do
@@ -36,6 +37,11 @@
::Guard.listener.directory.should eq '/usr'
end
+ it "changes the current work dir to the watchdir" do
+ Dir.should_receive(:chdir).with('/tmp')
+ ::Guard.setup(:watchdir => '/tmp')
+ end
+
it "call setup_signal_traps" do
::Guard.should_receive(:setup_signal_traps)
subject

0 comments on commit a6d7392

Please sign in to comment.