mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix issue with Puppet
See: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/monkey_patches.rb#L278
This commit is contained in:
parent
c316d76c06
commit
9a3793d1a1
2 changed files with 19 additions and 1 deletions
|
@ -267,7 +267,7 @@ class Pry
|
|||
end
|
||||
|
||||
def format_variables(type, vars)
|
||||
vars.sort_by(&:downcase).map{ |var| color(type, var) }
|
||||
vars.sort_by{ |var| var.to_s.downcase }.map{ |var| color(type, var) }
|
||||
end
|
||||
|
||||
def format_constants(mod, constants)
|
||||
|
|
|
@ -60,6 +60,24 @@ describe "ls" do
|
|||
pry_eval("ls Net::HTTP::Get.new('localhost')").should =~ /Net::HTTPGenericRequest#methods/
|
||||
end
|
||||
|
||||
it "should work for objects which instance_variables returns array of symbol but there is no Symbol#downcase" do
|
||||
test_case = "class Object; alias :fg :instance_variables; def instance_variables; fg.map(&:to_sym); end end;"
|
||||
normalize = "class Object; def instance_variables; fg; end end;"
|
||||
|
||||
test = lambda do
|
||||
begin
|
||||
pry_eval(test_case, "class GeFromulate2; @flurb=1.3; end", "cd GeFromulate2", "ls")
|
||||
pry_eval(normalize)
|
||||
rescue
|
||||
pry_eval(normalize)
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
test.should.not.raise
|
||||
end
|
||||
|
||||
|
||||
# see: https://travis-ci.org/pry/pry/jobs/5071918
|
||||
unless Pry::Helpers::BaseHelpers.rbx?
|
||||
it "should handle classes that (pathologically) define .ancestors" do
|
||||
|
|
Loading…
Reference in a new issue