Skip to content
Snippets Groups Projects
Unverified Commit a47aed1d authored by Rémy Coutable's avatar Rémy Coutable Committed by GitHub
Browse files

Merge pull request #916 from chadmetcalf/pry_deprecation

Pry 0.12.0 Deprecation warnings
parents e6aab49a 0ba79a63
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -276,11 +276,10 @@ module Guard
#
def _prompt(ending_char)
proc do |target_self, nest_level, pry|
history = pry.input_array.size
process = Guard.listener.paused? ? "pause" : "guard"
level = ":#{ nest_level }" unless nest_level.zero?
 
"[#{ history }] #{ _scope_for_prompt }#{ process }"\
"[#{ _history(pry) }] #{ _scope_for_prompt }#{ process }"\
"(#{ _clip_name(target_self) })#{ level }#{ ending_char } "
end
end
Loading
Loading
@@ -288,6 +287,15 @@ module Guard
def _clip_name(target)
Pry.view_clip(target)
end
def _history(pry)
# https://github.com/pry/pry/blob/5bf2585d0a49a4a3666a9eae80ee31153e3ffcf4/CHANGELOG.md#v0120-november-5-2018
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
return pry.input_array.size
end
pry.input_ring.size
end
end
end
end
Loading
Loading
@@ -140,7 +140,7 @@ RSpec.describe Guard::Jobs::PryWrapper do
expect(Pry).to receive(:view_clip).and_return("main")
end
 
let(:pry) { instance_double(Pry, input_array: []) }
let(:pry) { instance_double(Pry, input_ring: []) }
 
context "Guard is not paused" do
it 'displays "guard"' do
Loading
Loading
@@ -149,6 +149,17 @@ RSpec.describe Guard::Jobs::PryWrapper do
end
end
 
context "Guard is using a lower version of Pry" do
let(:pry) { instance_double(Pry, input_array: []) }
it 'displays "guard"' do
stub_const("Pry::VERSION", "0.11.0")
expect(prompt.call(double, 0, pry))
.to eq "[0] guard(main)> "
end
end
context "Guard is paused" do
before do
allow(listener).to receive(:paused?).and_return(true)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment