diff --git a/spec/commands/show_doc_spec.rb b/spec/commands/show_doc_spec.rb index 67d53402..66ac440a 100644 --- a/spec/commands/show_doc_spec.rb +++ b/spec/commands/show_doc_spec.rb @@ -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 diff --git a/spec/fixtures/show_source_doc_examples.rb b/spec/fixtures/show_source_doc_examples.rb index 6d8cddfc..90efc43c 100644 --- a/spec/fixtures/show_source_doc_examples.rb +++ b/spec/fixtures/show_source_doc_examples.rb @@ -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