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:
Jordon Bedwell 2012-04-05 14:01:45 -05:00
parent aff94083dc
commit d4de593f08
2 changed files with 17 additions and 1 deletions

View File

@ -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

View 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