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/show_doc_spec.rb
Kyrylo Silin f2ef3b6ed0 spec/commands/show_{doc,source}: refactor to be order independent
A bunch of tests were order-dependent and weren't cleaning up properly after
they're executed. This results in complications with #2055 where we want to
randomise our test suite.

With this change every test defines what it needs and then cleans up properly,
instead of relying on the global space and fixtures.

P.S. The specs are still quite messy but this change is a step in the right
direction.
2019-06-15 18:28:00 +03:00

19 lines
425 B
Ruby

# frozen_string_literal: true
describe "show-doc" do
before do
@obj = Object.new
# obj docs
def @obj.sample_method; end
end
it "emits a deprecation warning" do
expect(pry_eval(binding, 'show-doc @obj.sample_method'))
.to match(/WARNING: the show-doc command is deprecated/)
end
it "shows docs" do
expect(pry_eval(binding, 'show-doc @obj.sample_method')).to match(/obj docs/)
end
end