Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test case for ancestor modules and the show-source -s option

  • Loading branch information...
commit 0cc176cdf9aa68f096b5587a5946d80a2b8b2ded 1 parent 7ec0f55
@TreyLawrence TreyLawrence authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 test/test_default_commands/test_show_source.rb
View
13 test/test_default_commands/test_show_source.rb
@@ -237,7 +237,7 @@ def @o.hi; puts 'hi world'; end
it "source of variable should take precedence over method that is being shadowed" do
string = mock_pry(@method_shadow,"show-source hello","exit-all")
string.include?("def hello").should == false
- string =~ /proc { ' smile ' }/
+ string.should =~ /proc { ' smile ' }/
end
it "source of method being shadowed should take precedence over variable
@@ -261,7 +261,13 @@ def alpha
end
end
+ module ShowSourceTestSuperModule
+ def alpha
+ end
+ end
+
module ShowSourceTestModule
+ include ShowSourceTestSuperModule
def alpha
end
end
@@ -281,6 +287,7 @@ def beta
Object.remove_const :ShowSourceTestSuperClass
Object.remove_const :ShowSourceTestClass
Object.remove_const :ShowSourceTestClassWeirdSyntax
+ Object.remove_const :ShowSourceTestSuperModule
Object.remove_const :ShowSourceTestModule
Object.remove_const :ShowSourceTestModuleWeirdSyntax
end
@@ -298,6 +305,10 @@ def beta
mock_pry("show-source ShowSourceTestModule").should =~ /module ShowSourceTestModule/
end
+ it 'should show source for an ancestor module' do
+ mock_pry("show-source -s ShowSourceTestModule").should =~ /module ShowSourceTestSuperModule/
+ end
+
it 'should show source for a class when Const = Class.new syntax is used' do
mock_pry("show-source ShowSourceTestClassWeirdSyntax").should =~ /ShowSourceTestClassWeirdSyntax = Class.new/
end
Please sign in to comment.
Something went wrong with that request. Please try again.