mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
issue 998 test added
This commit is contained in:
parent
8ce2397bb4
commit
24ab88a307
3 changed files with 15 additions and 3 deletions
1
Gemfile
1
Gemfile
|
@ -6,7 +6,6 @@ group :development do
|
|||
gem 'jist'
|
||||
gem 'rb-inotify', :require => 'false'
|
||||
gem 'rb-fsevent', :require => 'false'
|
||||
gem 'debugger'
|
||||
end
|
||||
|
||||
if RbConfig::CONFIG['ruby_install_name'] == 'rbx'
|
||||
|
|
|
@ -64,7 +64,7 @@ class Pry
|
|||
from_obj(target.eval("self"), name, target)
|
||||
else
|
||||
from_str(name, target, :instance => true) or
|
||||
from_str(name, target, :methods => true)
|
||||
from_str(name, target, :methods => true)
|
||||
end
|
||||
|
||||
rescue Pry::RescuableException
|
||||
|
|
|
@ -62,12 +62,25 @@ describe Pry::Method do
|
|||
meth.should == nil
|
||||
end
|
||||
|
||||
it 'should look up methods using klass.new.method syntax' do
|
||||
it 'should look up methods using klass.new.method syntax' do
|
||||
klass = Class.new { def hello; :hello; end }
|
||||
meth = Pry::Method.from_str("klass.new.hello", Pry.binding_for(binding))
|
||||
meth.name.should == "hello"
|
||||
end
|
||||
|
||||
it 'should take care of corner cases like mongo[] e.g Foo::Bar.new[]- issue 998' do
|
||||
klass = Class.new { def []; :hello; end }
|
||||
meth = Pry::Method.from_str("klass.new[]", Pry.binding_for(binding))
|
||||
meth.name.should == "[]"
|
||||
end
|
||||
|
||||
it 'should take care of cases like $ mongo[] - issue 998' do
|
||||
f = Class.new { def []; :hello; end }
|
||||
binding.eval("f = {}")
|
||||
meth = Pry::Method.from_str("f[]", Pry.binding_for(binding))
|
||||
meth.name.should == "[]"
|
||||
end
|
||||
|
||||
it 'should look up instance methods using klass.meth#method syntax' do
|
||||
klass = Class.new { def self.meth; Class.new; end }
|
||||
meth = Pry::Method.from_str("klass.meth#initialize", Pry.binding_for(binding))
|
||||
|
|
Loading…
Reference in a new issue