From b1a7da53585f2d325e5d6929f2fd334cbf53c0b6 Mon Sep 17 00:00:00 2001 From: John Mair Date: Sun, 17 Feb 2013 20:20:37 +0100 Subject: [PATCH] whereami -c: Add test to ensure correct superclass is located also remove unnecessary instances of require 'fixture/whereami_helper' --- spec/commands/whereami_spec.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/spec/commands/whereami_spec.rb b/spec/commands/whereami_spec.rb index 664211ab..c93d7944 100644 --- a/spec/commands/whereami_spec.rb +++ b/spec/commands/whereami_spec.rb @@ -161,8 +161,27 @@ describe "whereami" do Object.remove_const(:Cor) end + it 'should show class when -c option used, and locate correct superclass' do + class Cor + def blimey! + 1 + 2 + out = pry_eval(binding, 'whereami -c') + out.should =~ /class Cor/ + out.should =~ /blimey/ + end + end + + class Horse < Cor + def pig;end + end + + Horse.new.blimey! + Object.remove_const(:Cor) + Object.remove_const(:Horse) + end + it 'should show class when -c option used, and binding is outside a method' do - require 'fixtures/whereami_helper' class Cor def blimey;end