spec/pry-doc_spec.rb in pry-doc-0.5.1 vs spec/pry-doc_spec.rb in pry-doc-0.6.0
- old
+ new
@@ -6,10 +6,11 @@
require "#{direc}/helper"
require "#{direc}/gem_with_cext/gems/sample"
require 'bacon'
require 'set'
require 'fileutils'
+require 'readline'
puts "Testing pry-doc version #{PryDoc::VERSION}..."
puts "Ruby version: #{RUBY_VERSION}"
describe PryDoc do
@@ -156,28 +157,34 @@
def self.my_method; end
end
lambda { Pry::MethodInfo.aliases(c.method(:my_method)) }.should.not.raise NameError
end
-
end
- if Pry::Helpers::BaseHelpers.mri_18?
- describe "1.8 specific docs" do
- it "finds Array#indexes" do
- obj = Pry::MethodInfo.info_for(Array.instance_method(:indexes))
- obj.should.not == nil
- end
+ describe ".gem_root" do
+ it "should return the path to the gem" do
+ path = Pry::WrappedModule.new(Sample).source_location[0]
+
+ Pry::MethodInfo.gem_root(path).should ==
+ File.expand_path("gem_with_cext/gems", direc)
end
+
+ it "should not be fooled by a parent 'lib' or 'ext' dir" do
+ path = "/foo/.rbenv/versions/1.9.3-p429/lib/ruby/gems/"\
+ "1.9.1/gems/activesupport-4.0.2/lib/active_support/"\
+ "core_ext/kernel/reporting.rb"
+
+ Pry::MethodInfo.gem_root(path).should ==
+ "/foo/.rbenv/versions/1.9.3-p429/lib/ruby/"\
+ "gems/1.9.1/gems/activesupport-4.0.2"
+ end
end
- # Ruby 1.9 and higher.
- if !Pry::Helpers::BaseHelpers.mri_18?
- describe "1.9 and higher specific docs" do
- it "finds Kernel#require_relative" do
- obj = Pry::MethodInfo.info_for(Kernel.instance_method(:require_relative))
- obj.should.not == nil
- end
+ describe "1.9 and higher specific docs" do
+ it "finds Kernel#require_relative" do
+ obj = Pry::MethodInfo.info_for(Kernel.instance_method(:require_relative))
+ obj.should.not == nil
end
end
# For the time being, Pry doesn't define `mri_20?` helper method.
if RUBY_VERSION =~ /2.0/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby'