Skip to content
This repository
Browse code

Remove global Pry hook after each spec.

  • Loading branch information...
commit 2cf660a0a57c0a3ef06b001af1d2b0b50ef3fc82 1 parent 3f20602
Michael Kessler netzpirat authored

Showing 2 changed files with 8 additions and 1 deletion. Show diff stats Hide diff stats

  1. +4 1 lib/guard/interactor.rb
  2. +4 0 spec/spec_helper.rb
5 lib/guard/interactor.rb
@@ -16,10 +16,13 @@ class Interactor
16 16 require 'guard/commands/pause'
17 17 require 'guard/commands/reload'
18 18 require 'guard/commands/show'
  19 +
19 20 GUARD_RC = '~/.guardrc'
20 21 HISTORY_FILE = '~/.guard_history'
21 22
22 23 def initialize
  24 + Pry.config.history.file = HISTORY_FILE
  25 +
23 26 Pry.config.hooks.add_hook :when_started, :load_guard_rc do
24 27 if File.exist? File.expand_path GUARD_RC
25 28 load GUARD_RC
@@ -31,7 +34,7 @@ def initialize
31 34 EOT
32 35 end
33 36 end
34   - Pry.config.history.file = HISTORY_FILE
  37 +
35 38 Pry.config.prompt = [
36 39 proc do |target_self, nest_level, pry|
37 40 "[#{pry.input_array.size}] #{ ::Guard.listener.paused? ? 'pause' : 'guard' }(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}> "
4 spec/spec_helper.rb
@@ -28,6 +28,10 @@
28 28 @guard_notifications = ::Guard::Notifier.notifications
29 29 end
30 30
  31 + config.after(:each) do
  32 + Pry.config.hooks.delete_hook(:when_started, :load_guard_rc)
  33 + end
  34 +
31 35 config.after(:all) do
32 36 ENV['GUARD_NOTIFY'] = @guard_notify
33 37 ::Guard::Notifier.notifications = @guard_notifications

0 comments on commit 2cf660a

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