summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-10-06 18:37:23 -0700
committerAndre Arko <andre@arko.net>2015-10-06 18:37:40 -0700
commit42e55b011f9007ea8ccb88ae3767226912b5622a (patch)
tree0bcbfb08636bbcfc126397d7b9f3bdf76e183ac0
parentf91ab22559b4d3a7ac9bbdb26716fadf8fdc1a82 (diff)
downloadbundler-42e55b011f9007ea8ccb88ae3767226912b5622a.tar.gz
update edge cases to only lock if possible
this speeds up these tests by a huge amount, since we stop downloading and installing a crapton of gems live over the internet
-rw-r--r--spec/realworld/edgecases_spec.rb38
-rw-r--r--spec/support/helpers.rb6
2 files changed, 27 insertions, 17 deletions
diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb
index bff69d1ff5..8b977f8290 100644
--- a/spec/realworld/edgecases_spec.rb
+++ b/spec/realworld/edgecases_spec.rb
@@ -3,18 +3,20 @@ require "spec_helper"
describe "real world edgecases", :realworld => true, :sometimes => true do
# there is no rbx-relative-require gem that will install on 1.9
it "ignores extra gems with bad platforms", :ruby => "~> 1.8.7" do
- install_gemfile <<-G
- source :rubygems
+ gemfile <<-G
+ source "https://rubygems.org"
gem "linecache", "0.46"
G
+ bundle :lock
expect(err).to eq("")
+ expect(exitstatus).to eq(0) if exitstatus
end
# https://github.com/bundler/bundler/issues/1202
it "bundle cache works with rubygems 1.3.7 and pre gems",
- :ruby => "~> 1.8.7", :rubygems => "~> 1.3.7" do
+ :ruby => "~> 1.8.7", "https://rubygems.org" => "~> 1.3.7" do
install_gemfile <<-G
- source :rubygems
+ source "https://rubygems.org"
gem "rack", "1.3.0.beta2"
gem "will_paginate", "3.0.pre2"
G
@@ -25,27 +27,29 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
# https://github.com/bundler/bundler/issues/1486
# this is a hash collision that only manifests on 1.8.7
it "finds the correct child versions", :ruby => "~> 1.8.7" do
- install_gemfile <<-G
- source :rubygems
+ gemfile <<-G
+ source "https://rubygems.org"
gem 'i18n', '~> 0.6.0'
gem 'activesupport', '~> 3.0'
gem 'activerecord', '~> 3.0'
gem 'builder', '~> 2.1.2'
G
- expect(out).to include("activemodel 3.0.5")
+ bundle :lock
+ expect(lockfile).to include("activemodel (3.0.5)")
end
it "resolves dependencies correctly", :ruby => "1.9.3" do
- install_gemfile <<-G
+ gemfile <<-G
source "https://rubygems.org"
gem 'rails', '~> 3.0'
gem 'capybara', '~> 2.2.0'
gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9
G
- expect(out).to include("rails 3.2.22")
- expect(out).to include("capybara 2.2.1")
+ bundle :lock
+ expect(lockfile).to include("rails (3.2.22)")
+ expect(lockfile).to include("capybara (2.2.1)")
end
it "installs the latest version of gxapi_rails", :ruby => "1.9.3" do
@@ -61,7 +65,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
end
it "installs the latest version of i18n" do
- install_gemfile <<-G
+ gemfile <<-G
source "https://rubygems.org"
gem "i18n", "~> 0.6.0"
@@ -69,15 +73,16 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
gem "activerecord", "~> 3.0"
gem "builder", "~> 2.1.2"
G
- expect(out).to include("i18n 0.6.11")
- expect(out).to include("activesupport 3.0.5")
+ bundle :lock
+ expect(lockfile).to include("i18n (0.6.11)")
+ expect(lockfile).to include("activesupport (3.0.5)")
end
# https://github.com/bundler/bundler/issues/1500
it "does not fail install because of gem plugins" do
realworld_system_gems("open_gem --version 1.4.2", "rake --version 0.9.2")
gemfile <<-G
- source :rubygems
+ source "https://rubygems.org"
gem 'rack', '1.0.1'
G
@@ -89,7 +94,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
it "checks out git repos when the lockfile is corrupted" do
gemfile <<-G
- source :rubygems
+ source "https://rubygems.org"
gem 'activerecord', :github => 'carlhuda/rails-bundler-test', :branch => 'master'
gem 'activesupport', :github => 'carlhuda/rails-bundler-test', :branch => 'master'
@@ -209,7 +214,8 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
activesupport!
L
- bundle :install
+ bundle :lock
+ expect(err).to eq("")
expect(exitstatus).to eq(0) if exitstatus
end
end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 228bf7699b..e06befc60e 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -175,7 +175,11 @@ module Spec
end
def lockfile(*args)
- create_file("Gemfile.lock", *args)
+ if args.empty?
+ File.open("Gemfile.lock", "r"){|f| f.read }
+ else
+ create_file("Gemfile.lock", *args)
+ end
end
def strip_whitespace(str)