Skip to content
Browse files

Remove global Pry hook after each spec.

  • Loading branch information...
1 parent 3f20602 commit 2cf660a0a57c0a3ef06b001af1d2b0b50ef3fc82 @netzpirat netzpirat committed Sep 20, 2012
Showing with 8 additions and 1 deletion.
  1. +4 −1 lib/guard/interactor.rb
  2. +4 −0 spec/spec_helper.rb
View
5 lib/guard/interactor.rb
@@ -16,10 +16,13 @@ class Interactor
require 'guard/commands/pause'
require 'guard/commands/reload'
require 'guard/commands/show'
+
GUARD_RC = '~/.guardrc'
HISTORY_FILE = '~/.guard_history'
def initialize
+ Pry.config.history.file = HISTORY_FILE
+
Pry.config.hooks.add_hook :when_started, :load_guard_rc do
if File.exist? File.expand_path GUARD_RC
load GUARD_RC
@@ -31,7 +34,7 @@ def initialize
EOT
end
end
- Pry.config.history.file = HISTORY_FILE
+
Pry.config.prompt = [
proc do |target_self, nest_level, pry|
"[#{pry.input_array.size}] #{ ::Guard.listener.paused? ? 'pause' : 'guard' }(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}> "
View
4 spec/spec_helper.rb
@@ -28,6 +28,10 @@
@guard_notifications = ::Guard::Notifier.notifications
end
+ config.after(:each) do
+ Pry.config.hooks.delete_hook(:when_started, :load_guard_rc)
+ end
+
config.after(:all) do
ENV['GUARD_NOTIFY'] = @guard_notify
::Guard::Notifier.notifications = @guard_notifications

0 comments on commit 2cf660a

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