1
0
Fork 0
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:
Deepender 2013-12-11 15:43:05 +05:30
parent 8ce2397bb4
commit 24ab88a307
3 changed files with 15 additions and 3 deletions

View file

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

View file

@ -68,6 +68,19 @@ describe Pry::Method do
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))