1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/spec/commands
Kyrylo Silin 157c7db32a core_extensions: make '__binding__' work with redefined #respond_to?
Fixes https://github.com/pry/pry/issues/1596
(Unable to inspect object built from class)
Replaces https://github.com/pry/pry/pull/1719
Big thanks to @egwspiti for the repro case and the proposed PR.

When a class redefines `respond_to?` or `method_missing` this leads to some
problems and confuses Pry. I found another example where Pry misbehaves:

```
[1] pry(main)> cd Class.new { def method_missing(*) end; def respond_to_missing?(*) true end; }.new
NoMethodError: private method `eval' called for nil:NilClass
from /Users/kyrylo/.gem/ruby/2.4.2/gems/pry-0.11.3/lib/pry/pry_instance.rb:163:in `inject_local'
```

By using `method_defined?` we can work around these bugs since this method
doesn't check whether the receiver responds to a certain message but checks
whether this method is defined (so we don't redefine it later). Seems like a
win-win.
2018-10-17 23:10:21 +08:00
..
cat modify lib/ and spec/ to use Pry::Slop 2015-12-11 06:04:54 +00:00
amend_line_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
bang_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
cat_spec.rb Drop support for Rubinius 2018-10-07 00:58:53 +08:00
cd_spec.rb core_extensions: make '__binding__' work with redefined #respond_to? 2018-10-17 23:10:21 +08:00
disable_pry_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
edit_spec.rb rubocop: fix offences of the Layout/EmptyLineBetweenDefs cop 2018-10-14 14:40:48 +08:00
exit_all_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
exit_program_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
exit_spec.rb rubocop: fix offences of the Style/HashSyntax cop 2018-10-13 03:09:29 +08:00
find_method_spec.rb rubocop: fix offences of the Layout/EmptyLineBetweenDefs cop 2018-10-14 14:40:48 +08:00
gem_list_spec.rb remove runtime dependency on slop ~> v3.4, fix specs that depended on it 2015-12-11 06:07:50 +00:00
gist_spec.rb rubocop: fix offences of the Layout/EmptyLineBetweenDefs cop 2018-10-14 14:40:48 +08:00
help_spec.rb rubocop: fix offences of the Style/HashSyntax cop 2018-10-13 03:09:29 +08:00
hist_spec.rb rubocop: fix offences of the Style/HashSyntax cop 2018-10-13 03:09:29 +08:00
jump_to_spec.rb rubocop: fix offences of the Layout/ExtraSpacing cop 2018-10-13 00:54:00 +08:00
ls_spec.rb Drop support for Rubinius 2018-10-07 00:58:53 +08:00
play_spec.rb rubocop: fix offences of the Layout/EmptyLineBetweenDefs cop 2018-10-14 14:40:48 +08:00
raise_up_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
reload_code_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
ri_command_spec.rb improve error message; add testcase for #1461 2015-08-19 10:40:11 +01:00
save_file_spec.rb rubocop: fix offences of the Layout/EmptyLineBetweenDefs cop 2018-10-14 14:40:48 +08:00
shell_command_spec.rb Drop support for Rubinius 2018-10-07 00:58:53 +08:00
show_doc_spec.rb rubocop: fix offences of the Lint/AmbiguousBlockAssociation cop 2018-10-16 04:38:17 +08:00
show_input_spec.rb specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
show_source_spec.rb rubocop: fix offences of the Lint/AmbiguousBlockAssociation cop 2018-10-16 04:38:17 +08:00
watch_expression_spec.rb hooks: rename #clear to #clear_event hooks and get rid of the alias 2015-03-14 10:08:16 +02:00
whereami_spec.rb Drop support for Rubinius 2018-10-07 00:58:53 +08:00
wtf_spec.rb commands/wtf,pry: add support for Exception#cause 2018-10-10 00:19:45 +08:00