1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

ShowDocSpec: add a test concerning monkeypatching

Make sure that `show-doc` displays the comments of the original
definition by default. This test *must* fail with current state of
things. The goal is to eliminate the oddities in Pry across some Ruby
implementations.

For more information see:
d05233ecd3
This commit is contained in:
Kyrylo Silin 2013-03-14 17:51:05 +02:00
parent d05233ecd3
commit 175c0e950b
2 changed files with 19 additions and 2 deletions

View file

@ -263,7 +263,18 @@ if !PryTestHelpers.mri18_and_no_real_source_location?
end
describe "messages relating to -a" do
it 'indicates all available monkeypatches can be shown with -a when' \
it "displays the original definition by default (not a doc of a monkeypatch)" do
class TestClassForCandidatesOrder
def beta
end
end
result = pry_eval("show-doc TestClassForCandidatesOrder")
result.should =~ /Number of monkeypatches: 2/
result.should =~ /The first definition/
end
it 'indicates all available monkeypatches can be shown with -a ' \
'(when -a not used and more than one candidate exists for class)' do
# Still reading boring tests, eh?
class TestClassForShowSource

View file

@ -1,4 +1,4 @@
# used by test_show_source.rb and test_documentation.rb
# used by show_source_spec.rb and show_doc_spec.rb
class TestClassForShowSource
#doc
def alpha
@ -14,3 +14,9 @@ class TestClassForShowSourceInstanceEval
def alpha
end
end
# The first definition (find the second one in show_doc_spec.rb).
class TestClassForCandidatesOrder
def alpha
end
end