mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Partially fix #516 (see list of notes for more)
* Move is_a? to == in pry_class.rb * Add test for __binding__ for @ConradIrwin. * Add regression test to prevent us from using is_a?(Binding).
This commit is contained in:
parent
aff94083dc
commit
d4de593f08
2 changed files with 17 additions and 1 deletions
|
@ -351,7 +351,7 @@ class Pry
|
|||
# @param [Object] target The object to get a `Binding` object for.
|
||||
# @return [Binding] The `Binding` object.
|
||||
def self.binding_for(target)
|
||||
if target.is_a?(Binding)
|
||||
if Binding === target
|
||||
target
|
||||
else
|
||||
if TOPLEVEL_BINDING.eval('self') == target
|
||||
|
|
16
test/test_default_commands/test_cd.rb
Normal file
16
test/test_default_commands/test_cd.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'helper'
|
||||
|
||||
describe 'Pry::DefaultCommands::CD' do
|
||||
describe 'cd' do
|
||||
# Regression test for ticket #516.
|
||||
#it 'should be able to cd into the Object BasicObject.' do
|
||||
# mock_pry('cd BasicObject.new').should.not =~ /\Aundefined method `__binding__'/
|
||||
#end
|
||||
|
||||
# Regression test for ticket #516
|
||||
# Possibly move higher up.
|
||||
it 'should not fail with undefined BasicObject#is_a?' do
|
||||
mock_pry('cd BasicObject.new').should.not =~ /undefined method `is_a\?'/
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue