Skip to content

Commit

Permalink
test based on gem version
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Sep 7, 2013
1 parent 103d40a commit 0ca7810
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/rubygems/dependent.rb
Expand Up @@ -32,7 +32,7 @@ def self.fetch_all_dependencies(specs_and_sources, options={})
parallel = (options[:parallel] || 15)
Gem::Dependent::Parallel.map(specs_and_sources, :in_processes => parallel) do |spec, source|
yield if block_given?
name, version = if RUBY_VERSION > "2"
name, version = if Gem::VERSION > "2"
[spec.name, spec.version]
else
spec[0,2]
Expand All @@ -45,7 +45,7 @@ def self.fetch_all_dependencies(specs_and_sources, options={})
def self.fetch_dependencies(spec, source, options={})
begin
fetcher = Gem::SpecFetcher.fetcher
if RUBY_VERSION > "2"
if Gem::VERSION > "2"
source.fetch_spec(spec).dependencies
else
fetcher.fetch_spec(spec, URI.parse(source)).dependencies
Expand Down Expand Up @@ -75,7 +75,7 @@ def self.all_specs_and_sources(options={})
matching_platform = false
prerelease = false
matcher = without_deprecation_warning { Gem::Dependency.new(//, Gem::Requirement.default) } # any name, any version
specs_and_sources = if RUBY_VERSION > "2"
specs_and_sources = if Gem::VERSION > "2"
fetcher.search_for_dependency(matcher, matching_platform).first
else
fetcher.find_matching matcher, all, matching_platform, prerelease
Expand All @@ -84,7 +84,7 @@ def self.all_specs_and_sources(options={})
if options[:all_versions]
specs_and_sources
else
uniq_by(specs_and_sources){|a| RUBY_VERSION > "2" ? a.first.name : a.first.first }
uniq_by(specs_and_sources){|a| Gem::VERSION > "2" ? a.first.name : a.first.first }
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/dependent_spec.rb
Expand Up @@ -62,7 +62,7 @@ def stub_source(options={})
it "obeys fetch-limit" do
stub_source
dependencies = simplify_gem_results(Gem::Dependent.find('hoe', :fetch_limit => 100))
dependencies.should == hoe_gems.first(RUBY_VERSION >= "2" ? 3 : 2)
dependencies.should == hoe_gems.first(Gem::VERSION >= "2" ? 3 : 2)
end

it "can use given source" do
Expand Down

0 comments on commit 0ca7810

Please sign in to comment.