summaryrefslogtreecommitdiff
path: root/spec/install
diff options
context:
space:
mode:
Diffstat (limited to 'spec/install')
-rw-r--r--spec/install/allow_offline_install_spec.rb6
-rw-r--r--spec/install/deploy_spec.rb17
-rw-r--r--spec/install/gemfile/eval_gemfile_spec.rb4
-rw-r--r--spec/install/gemfile/gemspec_spec.rb30
-rw-r--r--spec/install/gemfile/git_spec.rb127
-rw-r--r--spec/install/gemfile/path_spec.rb65
-rw-r--r--spec/install/gemfile/platform_spec.rb6
-rw-r--r--spec/install/gemfile/ruby_spec.rb6
-rw-r--r--spec/install/gemfile/sources_spec.rb4
-rw-r--r--spec/install/gemfile/specific_platform_spec.rb6
-rw-r--r--spec/install/gemfile_spec.rb12
-rw-r--r--spec/install/gems/compact_index_spec.rb128
-rw-r--r--spec/install/gems/dependency_api_spec.rb106
-rw-r--r--spec/install/gems/flex_spec.rb2
-rw-r--r--spec/install/gems/resolving_spec.rb62
-rw-r--r--spec/install/gems/standalone_spec.rb139
-rw-r--r--spec/install/gems/win32_spec.rb2
-rw-r--r--spec/install/gemspecs_spec.rb2
-rw-r--r--spec/install/git_spec.rb22
-rw-r--r--spec/install/global_cache_spec.rb52
-rw-r--r--spec/install/path_spec.rb42
21 files changed, 527 insertions, 313 deletions
diff --git a/spec/install/allow_offline_install_spec.rb b/spec/install/allow_offline_install_spec.rb
index 8af88b7efe..2662c12953 100644
--- a/spec/install/allow_offline_install_spec.rb
+++ b/spec/install/allow_offline_install_spec.rb
@@ -7,6 +7,8 @@ RSpec.describe "bundle install with :allow_offline_install" do
context "with no cached data locally" do
it "still installs" do
+ skip "corrupt test gem" if Gem.win_platform?
+
install_gemfile! <<-G, :artifice => "compact_index"
source "http://testgemserver.local"
gem "rack-obama"
@@ -26,6 +28,8 @@ RSpec.describe "bundle install with :allow_offline_install" do
context "with cached data locally" do
it "will install from the compact index" do
+ skip "corrupt test gem" if Gem.win_platform?
+
system_gems ["rack-1.0.0"], :path => :bundle_path
bundle! "config set clean false"
@@ -70,6 +74,8 @@ RSpec.describe "bundle install with :allow_offline_install" do
end
it "will install from a cached git repo" do
+ skip "doesn't print errors" if Gem.win_platform?
+
git = build_git "a", "1.0.0", :path => lib_path("a")
update_git("a", :path => git.path, :branch => "new_branch")
install_gemfile! <<-G
diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb
index f92a531bf5..5031bd9aa0 100644
--- a/spec/install/deploy_spec.rb
+++ b/spec/install/deploy_spec.rb
@@ -43,13 +43,12 @@ RSpec.describe "install with --deployment or --frozen" do
it "still works if you are not in the app directory and specify --gemfile" do
bundle! "install"
- Dir.chdir tmp do
- simulate_new_machine
- bundle! :install,
- forgotten_command_line_options(:gemfile => "#{tmp}/bundled_app/Gemfile",
- :deployment => true,
- :path => "vendor/bundle")
- end
+ simulate_new_machine
+ bundle! :install,
+ forgotten_command_line_options(:gemfile => "#{tmp}/bundled_app/Gemfile",
+ :deployment => true,
+ :path => "vendor/bundle",
+ :dir => tmp)
expect(the_bundle).to include_gems "rack 1.0"
end
@@ -65,6 +64,8 @@ RSpec.describe "install with --deployment or --frozen" do
end
it "works when you bundle exec bundle" do
+ skip "doesn't find bundle" if Gem.win_platform?
+
bundle! :install
bundle "install --deployment"
bundle! "exec bundle check"
@@ -83,6 +84,8 @@ RSpec.describe "install with --deployment or --frozen" do
end
it "works when there are credentials in the source URL" do
+ skip "corrupt test gem" if Gem.win_platform?
+
install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
source "http://user:pass@localgemserver.test/"
diff --git a/spec/install/gemfile/eval_gemfile_spec.rb b/spec/install/gemfile/eval_gemfile_spec.rb
index 7df94aaff5..69341250c3 100644
--- a/spec/install/gemfile/eval_gemfile_spec.rb
+++ b/spec/install/gemfile/eval_gemfile_spec.rb
@@ -28,8 +28,8 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
context "eval-ed Gemfile has relative-path gems" do
before do
- build_lib("a", :path => "gems/a")
- create_file "nested/Gemfile-nested", <<-G
+ build_lib("a", :path => bundled_app("gems/a"))
+ create_file bundled_app("nested/Gemfile-nested"), <<-G
gem "a", :path => "../gems/a"
G
diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb
index c50f8c9668..b28d70a798 100644
--- a/spec/install/gemfile/gemspec_spec.rb
+++ b/spec/install/gemfile/gemspec_spec.rb
@@ -120,18 +120,16 @@ RSpec.describe "bundle install from an existing gemspec" do
s.add_development_dependency "rake", "=12.3.2"
end
- Dir.chdir(tmp.join("foo")) do
- bundle "install"
- # This should really be able to rely on $stderr, but, it's not written
- # right, so we can't. In fact, this is a bug negation test, and so it'll
- # ghost pass in future, and will only catch a regression if the message
- # doesn't change. Exit codes should be used correctly (they can be more
- # than just 0 and 1).
- output = bundle("install --deployment")
- expect(output).not_to match(/You have added to the Gemfile/)
- expect(output).not_to match(/You have deleted from the Gemfile/)
- expect(output).not_to match(/install in deployment mode after changing/)
- end
+ bundle "install", :dir => tmp.join("foo")
+ # This should really be able to rely on $stderr, but, it's not written
+ # right, so we can't. In fact, this is a bug negation test, and so it'll
+ # ghost pass in future, and will only catch a regression if the message
+ # doesn't change. Exit codes should be used correctly (they can be more
+ # than just 0 and 1).
+ output = bundle("install --deployment", :dir => tmp.join("foo"))
+ expect(output).not_to match(/You have added to the Gemfile/)
+ expect(output).not_to match(/You have deleted from the Gemfile/)
+ expect(output).not_to match(/install in deployment mode after changing/)
end
it "should match a lockfile without needing to re-resolve" do
@@ -201,7 +199,7 @@ RSpec.describe "bundle install from an existing gemspec" do
it "allows the gemspec to activate other gems" do
ENV["BUNDLE_PATH__SYSTEM"] = "true"
- # see https://github.com/bundler/bundler/issues/5409
+ # see https://github.com/rubygems/bundler/issues/5409
#
# issue was caused by rubygems having an unresolved gem during a require,
# so emulate that
@@ -210,7 +208,7 @@ RSpec.describe "bundle install from an existing gemspec" do
build_lib("foo", :path => bundled_app)
gemspec = bundled_app("foo.gemspec").read
bundled_app("foo.gemspec").open("w") do |f|
- f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack-obama' }"
+ f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack/obama' }"
end
install_gemfile! <<-G
@@ -333,6 +331,8 @@ RSpec.describe "bundle install from an existing gemspec" do
let(:platform) { "ruby" }
before do
+ skip "not installing for some reason" if Gem.win_platform?
+
build_lib("foo", :path => tmp.join("foo")) do |s|
s.add_dependency "rack", "=1.0.0"
end
@@ -425,7 +425,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
- build_lib "foo", :path => "." do |s|
+ build_lib "foo", :path => bundled_app do |s|
if platform_specific_type == :runtime
s.add_runtime_dependency dependency
elsif platform_specific_type == :development
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index 00f8e96625..067de1777d 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -57,22 +57,18 @@ RSpec.describe "bundle install with git sources" do
it "does not update the git source implicitly" do
update_git "foo"
- in_app_root2 do
- install_gemfile bundled_app2("Gemfile"), <<-G
- git "#{lib_path("foo-1.0")}" do
- gem 'foo'
- end
- G
- end
+ install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2
+ git "#{lib_path("foo-1.0")}" do
+ gem 'foo'
+ end
+ G
- in_app_root do
- run <<-RUBY
- require 'foo'
- puts "fail" if defined?(FOO_PREV_REF)
- RUBY
+ run <<-RUBY
+ require 'foo'
+ puts "fail" if defined?(FOO_PREV_REF)
+ RUBY
- expect(out).to be_empty
- end
+ expect(out).to be_empty
end
it "sets up git gem executables on the path" do
@@ -129,19 +125,19 @@ RSpec.describe "bundle install with git sources" do
it "still works after moving the application directory" do
bundle "install --path vendor/bundle"
+
FileUtils.mv bundled_app, tmp("bundled_app.bck")
- Dir.chdir tmp("bundled_app.bck")
- expect(the_bundle).to include_gems "foo 1.0"
+ expect(the_bundle).to include_gems "foo 1.0", :dir => tmp("bundled_app.bck")
end
it "can still install after moving the application directory" do
bundle "install --path vendor/bundle"
+
FileUtils.mv bundled_app, tmp("bundled_app.bck")
update_git "foo", "1.1", :path => lib_path("foo-1.0")
- Dir.chdir tmp("bundled_app.bck")
gemfile tmp("bundled_app.bck/Gemfile"), <<-G
source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
@@ -151,9 +147,9 @@ RSpec.describe "bundle install with git sources" do
gem "rack", "1.0"
G
- bundle "update foo"
+ bundle "update foo", :dir => tmp("bundled_app.bck")
- expect(the_bundle).to include_gems "foo 1.1", "rack 1.0"
+ expect(the_bundle).to include_gems "foo 1.1", "rack 1.0", :dir => tmp("bundled_app.bck")
end
end
@@ -220,9 +216,7 @@ RSpec.describe "bundle install with git sources" do
s.write("lib/foo.rb", "raise 'FAIL'")
end
- Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
- end
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
# want to ensure we don't fallback to HEAD
update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s|
@@ -256,9 +250,7 @@ RSpec.describe "bundle install with git sources" do
s.write("lib/foo.rb", "raise 'FAIL'")
end
- Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
- end
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
# want to ensure we don't fallback to HEAD
update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s|
@@ -281,9 +273,7 @@ RSpec.describe "bundle install with git sources" do
end
it "does not download random non-head refs" do
- Dir.chdir(lib_path("foo-1.0")) do
- sys_exec!('git update-ref -m "Bundler Spec!" refs/bundler/1 master~1')
- end
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
bundle! "config set global_gem_cache true"
@@ -296,9 +286,7 @@ RSpec.describe "bundle install with git sources" do
# ensure we also git fetch after cloning
bundle! :update, :all => true
- Dir.chdir(Dir[home(".bundle/cache/git/foo-*")].first) do
- sys_exec("git ls-remote .")
- end
+ sys_exec("git ls-remote .", :dir => Dir[home(".bundle/cache/git/foo-*")].first)
expect(out).not_to include("refs/bundler/1")
end
@@ -307,11 +295,10 @@ RSpec.describe "bundle install with git sources" do
describe "when specifying a branch" do
let(:branch) { "branch" }
let(:repo) { build_git("foo").path }
- before(:each) do
- update_git("foo", :path => repo, :branch => branch)
- end
it "works" do
+ update_git("foo", :path => repo, :branch => branch)
+
install_gemfile <<-G
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
@@ -324,6 +311,10 @@ RSpec.describe "bundle install with git sources" do
context "when the branch starts with a `#`" do
let(:branch) { "#149/redirect-url-fragment" }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :branch => branch)
+
install_gemfile <<-G
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
@@ -337,6 +328,10 @@ RSpec.describe "bundle install with git sources" do
context "when the branch includes quotes" do
let(:branch) { %('") }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :branch => branch)
+
install_gemfile <<-G
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
@@ -351,11 +346,10 @@ RSpec.describe "bundle install with git sources" do
describe "when specifying a tag" do
let(:tag) { "tag" }
let(:repo) { build_git("foo").path }
- before(:each) do
- update_git("foo", :path => repo, :tag => tag)
- end
it "works" do
+ update_git("foo", :path => repo, :tag => tag)
+
install_gemfile <<-G
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
@@ -368,6 +362,10 @@ RSpec.describe "bundle install with git sources" do
context "when the tag starts with a `#`" do
let(:tag) { "#149/redirect-url-fragment" }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :tag => tag)
+
install_gemfile <<-G
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
@@ -381,6 +379,10 @@ RSpec.describe "bundle install with git sources" do
context "when the tag includes quotes" do
let(:tag) { %('") }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :tag => tag)
+
install_gemfile <<-G
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
@@ -463,7 +465,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- lockfile0 = File.read(bundled_app("Gemfile.lock"))
+ lockfile0 = File.read(bundled_app_lock)
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
update_git "rack", "0.8", :path => lib_path("local-rack") do |s|
@@ -473,7 +475,7 @@ RSpec.describe "bundle install with git sources" do
bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
- lockfile1 = File.read(bundled_app("Gemfile.lock"))
+ lockfile1 = File.read(bundled_app_lock)
expect(lockfile1).not_to eq(lockfile0)
end
@@ -485,7 +487,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- lockfile0 = File.read(bundled_app("Gemfile.lock"))
+ lockfile0 = File.read(bundled_app_lock)
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
update_git "rack", "0.8", :path => lib_path("local-rack")
@@ -493,7 +495,7 @@ RSpec.describe "bundle install with git sources" do
bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- lockfile1 = File.read(bundled_app("Gemfile.lock"))
+ lockfile1 = File.read(bundled_app_lock)
expect(lockfile1).not_to eq(lockfile0)
end
@@ -621,6 +623,8 @@ RSpec.describe "bundle install with git sources" do
end
it "installs dependencies from git even if a newer gem is available elsewhere" do
+ skip "override is not winning" if Gem.win_platform?
+
system_gems "rack-1.0.0"
build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s|
@@ -817,9 +821,7 @@ RSpec.describe "bundle install with git sources" do
bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.1"
- Dir.chdir(lib_path("forced-1.0")) do
- `git reset --hard HEAD^`
- end
+ sys_exec("git reset --hard HEAD^", :dir => lib_path("forced-1.0"))
bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.0"
@@ -830,10 +832,8 @@ RSpec.describe "bundle install with git sources" do
build_git "has_submodule", "1.0" do |s|
s.add_dependency "submodule"
end
- Dir.chdir(lib_path("has_submodule-1.0")) do
- sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0"
- `git commit -m "submodulator"`
- end
+ sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
+ sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
git "#{lib_path("has_submodule-1.0")}" do
@@ -850,10 +850,8 @@ RSpec.describe "bundle install with git sources" do
build_git "has_submodule", "1.0" do |s|
s.add_dependency "submodule"
end
- Dir.chdir(lib_path("has_submodule-1.0")) do
- sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0"
- `git commit -m "submodulator"`
- end
+ sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
+ sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
git "#{lib_path("has_submodule-1.0")}", :submodules => true do
@@ -916,6 +914,8 @@ RSpec.describe "bundle install with git sources" do
end
it "prints a friendly error if a file blocks the git repo" do
+ skip "drive letter is not detected correctly in error message" if Gem.win_platform?
+
build_git "foo"
FileUtils.mkdir_p(default_bundle_path)
@@ -943,7 +943,7 @@ RSpec.describe "bundle install with git sources" do
gem "bar", :git => "#{lib_path("nested")}"
G
- expect(File.read(bundled_app("Gemfile.lock")).scan("GIT").size).to eq(1)
+ expect(File.read(bundled_app_lock).scan("GIT").size).to eq(1)
end
describe "switching sources" do
@@ -1003,8 +1003,8 @@ RSpec.describe "bundle install with git sources" do
update_git "valim"
new_revision = revision_for(lib_path("valim-1.0"))
- old_lockfile = File.read(bundled_app("Gemfile.lock"))
- lockfile(bundled_app("Gemfile.lock"), old_lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}"))
+ old_lockfile = File.read(bundled_app_lock)
+ lockfile(bundled_app_lock, old_lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}"))
bundle "install"
@@ -1150,16 +1150,15 @@ RSpec.describe "bundle install with git sources" do
end
2.times do |i|
- Dir.chdir(git_reader.path) do
- File.open("ext/foo.c", "w") do |file|
- file.write <<-C
- #include "ruby.h"
- VALUE foo() { return INT2FIX(#{i}); }
- void Init_foo() { rb_define_global_function("foo", &foo, 0); }
- C
- end
- `git commit -m "commit for iteration #{i}" ext/foo.c`
+ File.open(git_reader.path.join("ext/foo.c"), "w") do |file|
+ file.write <<-C
+ #include "ruby.h"
+ VALUE foo() { return INT2FIX(#{i}); }
+ void Init_foo() { rb_define_global_function("foo", &foo, 0); }
+ C
end
+ sys_exec("git commit -m \"commit for iteration #{i}\" ext/foo.c", :dir => git_reader.path)
+
git_commit_sha = git_reader.ref_for("HEAD")
install_gemfile <<-G
diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index b21c08ec92..a733c02512 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe "bundle install with explicit source paths" do
it "supports relative paths" do
build_lib "foo"
- relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new(Dir.pwd))
+ relative_path = lib_path("foo-1.0").relative_path_from(bundled_app)
install_gemfile <<-G
gem 'foo', :path => "#{relative_path}"
@@ -59,6 +59,8 @@ RSpec.describe "bundle install with explicit source paths" do
end
it "expands paths raise error with not existing user's home dir" do
+ skip "problems with ~ expansion" if Gem.win_platform?
+
build_lib "foo"
username = "some_unexisting_user"
relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("/home/#{username}").expand_path)
@@ -77,10 +79,7 @@ RSpec.describe "bundle install with explicit source paths" do
gem 'foo', :path => "./foo-1.0"
G
- bundled_app("subdir").mkpath
- Dir.chdir(bundled_app("subdir")) do
- expect(the_bundle).to include_gems("foo 1.0")
- end
+ expect(the_bundle).to include_gems("foo 1.0", :dir => bundled_app("subdir").mkpath)
end
it "sorts paths consistently on install and update when they start with ./" do
@@ -119,12 +118,10 @@ RSpec.describe "bundle install with explicit source paths" do
#{Bundler::VERSION}
L
- Dir.chdir(lib_path("demo")) do
- bundle :install
- expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
- bundle :update, :all => true
- expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
- end
+ bundle :install, :dir => lib_path("demo")
+ expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
+ bundle :update, :all => true, :dir => lib_path("demo")
+ expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
end
it "expands paths when comparing locked paths to Gemfile paths" do
@@ -139,6 +136,8 @@ RSpec.describe "bundle install with explicit source paths" do
end
it "installs dependencies from the path even if a newer gem is available elsewhere" do
+ skip "override is not winning" if Gem.win_platform?
+
system_gems "rack-1.0.0"
build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s|
@@ -245,11 +244,9 @@ RSpec.describe "bundle install with explicit source paths" do
File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts gemfile }
- Dir.chdir(lib_path("foo")) do
- bundle "install"
- expect(the_bundle).to include_gems "foo 1.0"
- expect(the_bundle).to include_gems "rack 1.0"
- end
+ bundle "install", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo")
end
it "supports gemspec syntax with an alternative path" do
@@ -271,19 +268,17 @@ RSpec.describe "bundle install with explicit source paths" do
s.add_dependency "rack", ">= 1.0"
end
- Dir.chdir lib_path("foo")
-
- install_gemfile lib_path("foo/Gemfile"), <<-G
+ install_gemfile lib_path("foo/Gemfile"), <<-G, :dir => lib_path("foo")
source "#{file_uri_for(gem_repo1)}"
gemspec
G
build_gem "rack", "1.0.1", :to_system => true
- bundle "install"
+ bundle "install", :dir => lib_path("foo")
- expect(the_bundle).to include_gems "foo 1.0"
- expect(the_bundle).to include_gems "rack 1.0"
+ expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo")
end
it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do
@@ -292,19 +287,17 @@ RSpec.describe "bundle install with explicit source paths" do
s.add_development_dependency "activesupport"
end
- Dir.chdir lib_path("foo")
-
- install_gemfile lib_path("foo/Gemfile"), <<-G
+ install_gemfile lib_path("foo/Gemfile"), <<-G, :dir => lib_path("foo")
source "#{file_uri_for(gem_repo1)}"
gemspec
G
build_gem "rack", "1.0.1", :to_system => true
- bundle "install"
+ bundle "install", :dir => lib_path("foo")
- expect(the_bundle).to include_gems "foo 1.0"
- expect(the_bundle).to include_gems "rack 1.0"
+ expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo")
end
it "raises if there are multiple gemspecs" do
@@ -422,7 +415,7 @@ RSpec.describe "bundle install with explicit source paths" do
remote: http://rubygems.org
L
- in_app_root { FileUtils.mkdir_p("vendor/bar") }
+ FileUtils.mkdir_p(bundled_app("vendor/bar"))
install_gemfile <<-G
gem "bar", "1.0.0", path: "vendor/bar", require: "bar/nyard"
@@ -644,6 +637,8 @@ RSpec.describe "bundle install with explicit source paths" do
describe "when there are both a gemspec and remote gems" do
it "doesn't query rubygems for local gemspec name" do
+ skip "platform issues" if Gem.win_platform?
+
build_lib "private_lib", "2.2", :path => lib_path("private_lib")
gemfile = <<-G
source "http://localgemserver.test"
@@ -652,13 +647,11 @@ RSpec.describe "bundle install with explicit source paths" do
G
File.open(lib_path("private_lib/Gemfile"), "w") {|f| f.puts gemfile }
- Dir.chdir(lib_path("private_lib")) do
- bundle :install, :env => { "DEBUG" => "1" }, :artifice => "endpoint"
- expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$})
- expect(out).not_to match(/^HTTP GET.*private_lib/)
- expect(the_bundle).to include_gems "private_lib 2.2"
- expect(the_bundle).to include_gems "rack 1.0"
- end
+ bundle :install, :env => { "DEBUG" => "1" }, :artifice => "endpoint", :dir => lib_path("private_lib")
+ expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$})
+ expect(out).not_to match(/^HTTP GET.*private_lib/)
+ expect(the_bundle).to include_gems "private_lib 2.2", :dir => lib_path("private_lib")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("private_lib")
end
end
diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb
index c096531398..52e1cf86fa 100644
--- a/spec/install/gemfile/platform_spec.rb
+++ b/spec/install/gemfile/platform_spec.rb
@@ -274,6 +274,8 @@ end
RSpec.describe "bundle install with platform conditionals" do
it "installs gems tagged w/ the current platforms" do
+ skip "platform issues" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -299,6 +301,8 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "installs gems tagged w/ the current platforms inline" do
+ skip "platform issues" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "nokogiri", :platforms => :#{local_tag}
@@ -317,6 +321,8 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "installs gems tagged w/ the current platform inline" do
+ skip "platform issues" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "nokogiri", :platform => :#{local_tag}
diff --git a/spec/install/gemfile/ruby_spec.rb b/spec/install/gemfile/ruby_spec.rb
index d1e9fc7e05..aab269b325 100644
--- a/spec/install/gemfile/ruby_spec.rb
+++ b/spec/install/gemfile/ruby_spec.rb
@@ -2,10 +2,10 @@
RSpec.describe "ruby requirement" do
def locked_ruby_version
- Bundler::RubyVersion.from_string(Bundler::LockfileParser.new(lockfile).ruby_version)
+ Bundler::RubyVersion.from_string(Bundler::LockfileParser.new(File.read(bundled_app_lock)).ruby_version)
end
- # As discovered by https://github.com/bundler/bundler/issues/4147, there is
+ # As discovered by https://github.com/rubygems/bundler/issues/4147, there is
# no test coverage to ensure that adding a gem is possible with a ruby
# requirement. This test verifies the fix, committed in bfbad5c5.
it "allows adding gems" do
@@ -51,6 +51,7 @@ RSpec.describe "ruby requirement" do
gem "rack"
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(locked_ruby_version).to eq(Bundler::RubyVersion.system)
simulate_ruby_version "5100"
@@ -72,6 +73,7 @@ RSpec.describe "ruby requirement" do
gem "rack"
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(locked_ruby_version).to eq(Bundler::RubyVersion.system)
simulate_ruby_version "5100"
diff --git a/spec/install/gemfile/sources_spec.rb b/spec/install/gemfile/sources_spec.rb
index 61943ef2e5..8b52833ba1 100644
--- a/spec/install/gemfile/sources_spec.rb
+++ b/spec/install/gemfile/sources_spec.rb
@@ -285,7 +285,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
- # In https://github.com/bundler/bundler/issues/3585 this failed
+ # In https://github.com/rubygems/bundler/issues/3585 this failed
# when there is already a lock file, and the gems are missing, so try again
system_gems []
bundle :install
@@ -426,7 +426,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
- # Reproduction of https://github.com/bundler/bundler/issues/3298
+ # Reproduction of https://github.com/rubygems/bundler/issues/3298
it "does not unlock the installed gem on exec" do
expect(the_bundle).to include_gems("rack 0.9.1")
end
diff --git a/spec/install/gemfile/specific_platform_spec.rb b/spec/install/gemfile/specific_platform_spec.rb
index 24b602589f..a1cc6b3551 100644
--- a/spec/install/gemfile/specific_platform_spec.rb
+++ b/spec/install/gemfile/specific_platform_spec.rb
@@ -58,6 +58,7 @@ RSpec.describe "bundle install with specific_platform enabled" do
it "locks to both the specific darwin platform and ruby" do
install_gemfile!(google_protobuf)
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")])
expect(the_bundle).to include_gem("google-protobuf 3.0.0.alpha.5.0.5.1 universal-darwin")
expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[
@@ -78,6 +79,7 @@ RSpec.describe "bundle install with specific_platform enabled" do
source "#{file_uri_for(gem_repo2)}"
gem "facter"
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")])
expect(the_bundle).to include_gems("facter 2.4.6 universal-darwin", "CFPropertyList 1.0")
@@ -87,6 +89,10 @@ RSpec.describe "bundle install with specific_platform enabled" do
end
context "when adding a platform via lock --add_platform" do
+ before do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ end
+
it "adds the foreign platform" do
install_gemfile!(google_protobuf)
bundle! "lock --add-platform=#{x64_mingw}"
diff --git a/spec/install/gemfile_spec.rb b/spec/install/gemfile_spec.rb
index dd08939cb0..e760f87ec1 100644
--- a/spec/install/gemfile_spec.rb
+++ b/spec/install/gemfile_spec.rb
@@ -44,20 +44,14 @@ RSpec.describe "bundle install" do
end
it "uses the gemfile while in a subdirectory" do
bundled_app("subdir").mkpath
- Dir.chdir(bundled_app("subdir")) do
- bundle "install"
- bundle "list"
+ bundle "install", :dir => bundled_app("subdir")
+ bundle "list", :dir => bundled_app("subdir")
- expect(out).to include("rack (1.0.0)")
- end
+ expect(out).to include("rack (1.0.0)")
end
end
context "with deprecated features" do
- before :each do
- in_app_root
- end
-
it "reports that lib is an invalid option" do
gemfile <<-G
gem "rack", :lib => "rack"
diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb
index a294b83d1c..be6c01aee9 100644
--- a/spec/install/gems/compact_index_spec.rb
+++ b/spec/install/gems/compact_index_spec.rb
@@ -5,6 +5,8 @@ RSpec.describe "compact index api" do
let(:source_uri) { "http://#{source_hostname}" }
it "should use the API" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -26,6 +28,8 @@ RSpec.describe "compact index api" do
end
it "should handle nested dependencies" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rails"
@@ -44,6 +48,8 @@ RSpec.describe "compact index api" do
end
it "should handle case sensitivity conflicts" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo4 do
build_gem "rack", "1.0" do |s|
s.add_runtime_dependency("Rack", "0.1")
@@ -64,6 +70,8 @@ RSpec.describe "compact index api" do
end
it "should handle multiple gem dependencies on the same gem" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "net-sftp"
@@ -74,6 +82,8 @@ RSpec.describe "compact index api" do
end
it "should use the endpoint when using --deployment" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -86,6 +96,8 @@ RSpec.describe "compact index api" do
end
it "handles git dependencies that are in rubygems" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_git "foo" do |s|
s.executables = "foobar"
s.add_dependency "rails", "2.3.2"
@@ -104,6 +116,8 @@ RSpec.describe "compact index api" do
end
it "handles git dependencies that are in rubygems using --deployment" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_git "foo" do |s|
s.executables = "foobar"
s.add_dependency "rails", "2.3.2"
@@ -148,6 +162,8 @@ RSpec.describe "compact index api" do
end
it "falls back when the API URL returns 403 Forbidden" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -159,6 +175,8 @@ RSpec.describe "compact index api" do
end
it "falls back when the versions endpoint has a checksum mismatch" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -173,6 +191,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "falls back when the user's home directory does not exist or is not writable" do
+ skip "artifice issues?" if Gem.win_platform?
+
ENV["HOME"] = tmp("missing_home").to_s
gemfile <<-G
@@ -186,6 +206,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "handles host redirects" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -196,6 +218,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "handles host redirects without Net::HTTP::Persistent" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -220,6 +244,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "times out when Bundler::Fetcher redirects too much" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -230,6 +256,10 @@ The checksum of /versions does not match the checksum provided by the server! So
end
context "when --full-index is specified" do
+ before do
+ skip "artifice issues?" if Gem.win_platform?
+ end
+
it "should use the modern index for install" do
gemfile <<-G
source "#{source_uri}"
@@ -270,6 +300,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -288,6 +320,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "fetches again when more dependencies are found in subsequent sources with source blocks" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -306,6 +340,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "fetches gem versions even when those gems are already installed" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack", "1.0.0"
@@ -329,6 +365,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
@@ -353,6 +391,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
@@ -378,6 +418,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "prints API output properly with back deps" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -399,6 +441,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "does not fetch every spec if the index of gems is large when doing back deps" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -424,6 +468,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "does not fetch every spec if the index of gems is large when doing back deps & everything is the compact index" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo4 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -448,6 +494,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "uses the endpoint if all sources support it" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
@@ -459,6 +507,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -479,6 +529,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "fetches again when more dependencies are found in subsequent sources using --deployment with blocks" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -500,6 +552,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "does not refetch if the only unmet dependency is bundler" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
@@ -523,6 +577,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "installs the binstubs", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -535,6 +591,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -546,6 +604,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -557,6 +617,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "prints post_install_messages" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack-obama'
@@ -567,6 +629,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "should display the post install message for a dependency" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack_middleware'
@@ -581,7 +645,7 @@ The checksum of /versions does not match the checksum provided by the server! So
let(:user) { "user" }
let(:password) { "pass" }
let(:basic_auth_source_uri) do
- uri = URI.parse(source_uri)
+ uri = Bundler::URI.parse(source_uri)
uri.user = user
uri.password = password
@@ -589,6 +653,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "passes basic authentication details and strips out creds" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -600,6 +666,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "strips http basic authentication creds for modern index" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -621,6 +689,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
source "#{file_uri_for(gem_repo1)}"
@@ -634,6 +704,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "does not pass the user / password to different hosts on redirect" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -652,6 +724,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "reads authentication details by host name from bundle config" do
+ skip "artifice issues?" if Gem.win_platform?
+
bundle "config set #{source_hostname} #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
@@ -661,6 +735,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "reads authentication details by full url from bundle config" do
+ skip "artifice issues?" if Gem.win_platform?
+
# The trailing slash is necessary here; Fetcher canonicalizes the URI.
bundle "config set #{source_uri}/ #{user}:#{password}"
@@ -671,6 +747,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "should use the API" do
+ skip "artifice issues?" if Gem.win_platform?
+
bundle "config set #{source_hostname} #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
expect(out).to include("Fetching gem metadata from #{source_uri}")
@@ -678,6 +756,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "prefers auth supplied in the source uri" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -706,6 +786,8 @@ The checksum of /versions does not match the checksum provided by the server! So
let(:password) { nil }
it "passes basic authentication details" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -762,27 +844,31 @@ The checksum of /versions does not match the checksum provided by the server! So
end
context ".gemrc with sources is present" do
- before do
+ it "uses other sources declared in the Gemfile" do
+ skip "artifice issues?" if Gem.win_platform?
+
File.open(home(".gemrc"), "w") do |file|
file.puts({ :sources => ["https://rubygems.org"] }.to_yaml)
end
- end
- after do
- home(".gemrc").rmtree
- end
+ begin
+ gemfile <<-G
+ source "#{source_uri}"
+ gem 'rack'
+ G
- it "uses other sources declared in the Gemfile" do
- gemfile <<-G
- source "#{source_uri}"
- gem 'rack'
- G
+ bundle! :install, :artifice => "compact_index_forbidden"
- bundle! :install, :artifice => "compact_index_forbidden"
+ expect(exitstatus).to eq(0) if exitstatus
+ ensure
+ home(".gemrc").rmtree
+ end
end
end
it "performs partial update with a non-empty range" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack', '0.9.1'
@@ -804,6 +890,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "performs partial update while local cache is updated by another process" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack'
@@ -822,6 +910,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "performs full update of compact index info cache if range is not satisfiable" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack', '0.9.1'
@@ -865,6 +955,8 @@ The checksum of /versions does not match the checksum provided by the server! So
describe "checksum validation" do
it "raises when the checksum does not match" do
+ skip "artifice issues?" if Gem.win_platform?
+
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum"
source "#{source_uri}"
gem "rack"
@@ -885,6 +977,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "raises when the checksum is the wrong length" do
+ skip "artifice issues?" if Gem.win_platform?
+
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!" }
source "#{source_uri}"
gem "rack"
@@ -894,6 +988,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "does not raise when disable_checksum_validation is set" do
+ skip "artifice issues?" if Gem.win_platform?
+
bundle! "config set disable_checksum_validation true"
install_gemfile! <<-G, :artifice => "compact_index_wrong_gem_checksum"
source "#{source_uri}"
@@ -903,6 +999,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "works when cache dir is world-writable" do
+ skip "artifice issues?" if Gem.win_platform?
+
install_gemfile! <<-G, :artifice => "compact_index"
File.umask(0000)
source "#{source_uri}"
@@ -911,6 +1009,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "doesn't explode when the API dependencies are wrong" do
+ skip "artifice issues?" if Gem.win_platform?
+
install_gemfile <<-G, :artifice => "compact_index_wrong_dependencies", :env => { "DEBUG" => "true" }
source "#{source_uri}"
gem "rails"
@@ -927,13 +1027,15 @@ Either installing with `--full-index` or running `bundle update rails` should fi
end
it "does not duplicate specs in the lockfile when updating and a dependency is not installed" do
+ skip "artifice issues?" if Gem.win_platform?
+
install_gemfile! <<-G, :artifice => "compact_index"
source "#{source_uri}" do
gem "rails"
gem "activemerchant"
end
G
- gem_command! :uninstall, "activemerchant"
+ gem_command! "uninstall activemerchant"
bundle! "update rails", :artifice => "compact_index"
expect(lockfile.scan(/activemerchant \(/).size).to eq(1)
end
diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb
index a8713eb445..78cca5f8b7 100644
--- a/spec/install/gems/dependency_api_spec.rb
+++ b/spec/install/gems/dependency_api_spec.rb
@@ -5,6 +5,8 @@ RSpec.describe "gemcutter's dependency API" do
let(:source_uri) { "http://#{source_hostname}" }
it "should use the API" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -26,6 +28,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "should handle nested dependencies" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rails"
@@ -44,6 +48,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "should handle multiple gem dependencies on the same gem" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "net-sftp"
@@ -54,6 +60,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "should use the endpoint when using --deployment" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -66,6 +74,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "handles git dependencies that are in rubygems" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_git "foo" do |s|
s.executables = "foobar"
s.add_dependency "rails", "2.3.2"
@@ -84,6 +94,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "handles git dependencies that are in rubygems using --deployment" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_git "foo" do |s|
s.executables = "foobar"
s.add_dependency "rails", "2.3.2"
@@ -128,6 +140,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "falls back when hitting the Gemcutter Dependency Limit" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "activesupport"
@@ -154,6 +168,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "falls back when Gemcutter API doesn't return proper Marshal format" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -165,6 +181,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "falls back when the API URL returns 403 Forbidden" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -176,6 +194,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "handles host redirects" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -186,6 +206,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "handles host redirects without Net::HTTP::Persistent" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -210,6 +232,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "timeouts when Bundler::Fetcher redirects too much" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -220,6 +244,10 @@ RSpec.describe "gemcutter's dependency API" do
end
context "when --full-index is specified" do
+ before do
+ skip "artifice issues?" if Gem.win_platform?
+ end
+
it "should use the modern index for install" do
gemfile <<-G
source "#{source_uri}"
@@ -244,6 +272,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -262,6 +292,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "fetches again when more dependencies are found in subsequent sources using blocks" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -281,6 +313,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "fetches gem versions even when those gems are already installed" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack", "1.0.0"
@@ -303,6 +337,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
@@ -327,6 +363,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "considers all possible versions of dependencies from all api gem sources using blocks" do
+ skip "artifice issues?" if Gem.win_platform?
+
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
@@ -352,6 +390,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "prints API output properly with back deps" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -373,6 +413,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "does not fetch every spec if the index of gems is large when doing back deps", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -397,6 +439,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "does not fetch every spec if the index of gems is large when doing back deps using blocks" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -422,6 +466,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "uses the endpoint if all sources support it" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
@@ -433,6 +479,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -453,6 +501,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "fetches again when more dependencies are found in subsequent sources using --deployment with blocks" do
+ skip "artifice issues?" if Gem.win_platform?
+
build_repo2 do
build_gem "back_deps" do |s|
s.add_dependency "foo"
@@ -497,6 +547,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "installs the binstubs", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -509,6 +561,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -520,6 +574,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -531,6 +587,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "prints post_install_messages" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack-obama'
@@ -541,6 +599,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "should display the post install message for a dependency" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack_middleware'
@@ -555,7 +615,7 @@ RSpec.describe "gemcutter's dependency API" do
let(:user) { "user" }
let(:password) { "pass" }
let(:basic_auth_source_uri) do
- uri = URI.parse(source_uri)
+ uri = Bundler::URI.parse(source_uri)
uri.user = user
uri.password = password
@@ -563,6 +623,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "passes basic authentication details and strips out creds" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -574,6 +636,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "strips http basic authentication creds for modern index" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -595,6 +659,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
source "#{file_uri_for(gem_repo1)}"
@@ -608,6 +674,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "does not pass the user / password to different hosts on redirect" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -626,6 +694,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "reads authentication details by host name from bundle config" do
+ skip "artifice issues?" if Gem.win_platform?
+
bundle "config set #{source_hostname} #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
@@ -635,6 +705,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "reads authentication details by full url from bundle config" do
+ skip "artifice issues?" if Gem.win_platform?
+
# The trailing slash is necessary here; Fetcher canonicalizes the URI.
bundle "config set #{source_uri}/ #{user}:#{password}"
@@ -645,6 +717,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "should use the API" do
+ skip "artifice issues?" if Gem.win_platform?
+
bundle "config set #{source_hostname} #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
expect(out).to include("Fetching gem metadata from #{source_uri}")
@@ -652,6 +726,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "prefers auth supplied in the source uri" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -680,6 +756,8 @@ RSpec.describe "gemcutter's dependency API" do
let(:password) { nil }
it "passes basic authentication details" do
+ skip "artifice issues?" if Gem.win_platform?
+
gemfile <<-G
source "#{basic_auth_source_uri}"
gem "rack"
@@ -736,25 +814,25 @@ RSpec.describe "gemcutter's dependency API" do
end
context ".gemrc with sources is present" do
- before do
+ it "uses other sources declared in the Gemfile" do
+ skip "artifice issues?" if Gem.win_platform?
+
File.open(home(".gemrc"), "w") do |file|
file.puts({ :sources => ["https://rubygems.org"] }.to_yaml)
end
- end
- after do
- home(".gemrc").rmtree
- end
-
- it "uses other sources declared in the Gemfile" do
- gemfile <<-G
- source "#{source_uri}"
- gem 'rack'
- G
+ begin
+ gemfile <<-G
+ source "#{source_uri}"
+ gem 'rack'
+ G
- bundle "install", :artifice => "endpoint_marshal_fail"
+ bundle "install", :artifice => "endpoint_marshal_fail"
- expect(exitstatus).to eq(0) if exitstatus
+ expect(exitstatus).to eq(0) if exitstatus
+ ensure
+ home(".gemrc").rmtree
+ end
end
end
end
diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb
index 865bc7b72a..77891acc24 100644
--- a/spec/install/gems/flex_spec.rb
+++ b/spec/install/gems/flex_spec.rb
@@ -233,7 +233,7 @@ RSpec.describe "bundle flex_install" do
it "does something" do
expect do
bundle "install"
- end.not_to change { File.read(bundled_app("Gemfile.lock")) }
+ end.not_to change { File.read(bundled_app_lock) }
expect(err).to include("rack = 0.9.1")
expect(err).to include("locked at 1.0.0")
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index 52511ff67f..323b28fdb1 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -19,6 +19,8 @@ RSpec.describe "bundle install with install-time dependencies" do
end
it "installs gems with a dependency with no type" do
+ skip "incorrect data check error" if Gem.win_platform?
+
build_repo2
path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz"
@@ -67,6 +69,20 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(the_bundle).to include_gems "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0"
end
+ context "with ENV['BUNDLER_DEBUG_RESOLVER'] set" do
+ it "produces debug output" do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "net_c"
+ gem "net_e"
+ G
+
+ bundle :install, :env => { "BUNDLER_DEBUG_RESOLVER" => "1" }
+
+ expect(err).to include("Creating possibility state for net_c")
+ end
+ end
+
context "with ENV['DEBUG_RESOLVER'] set" do
it "produces debug output" do
gemfile <<-G
@@ -101,6 +117,10 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "when a required ruby version" do
context "allows only an older version" do
+ before do
+ skip "gem not found" if Gem.win_platform?
+ end
+
it "installs the older version" do
build_repo2 do
build_gem "rack", "9001.0.0" do |s|
@@ -137,6 +157,31 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
expect(the_bundle).to include_gems("rack 1.2")
end
+
+ it "installs the older not platform specific version" do
+ build_repo4 do
+ build_gem "rack", "9001.0.0" do |s|
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2" do |s|
+ s.platform = mingw
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2"
+ end
+
+ simulate_platform mingw do
+ install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
+ ruby "#{RUBY_VERSION}"
+ source "http://localgemserver.test/"
+ gem 'rack'
+ G
+ end
+
+ expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
+ expect(out).to_not include("rack-1.2-#{Bundler.local_platform} requires ruby version > 9000")
+ expect(the_bundle).to include_gems("rack 1.2")
+ end
end
context "allows no gems" do
@@ -150,9 +195,18 @@ RSpec.describe "bundle install with install-time dependencies" do
let(:ruby_requirement) { %("#{RUBY_VERSION}") }
let(:error_message_requirement) { "~> #{RUBY_VERSION}.0" }
+ let(:error_message_platform) do
+ if Bundler.feature_flag.specific_platform?
+ " #{Bundler.local_platform}"
+ else
+ ""
+ end
+ end
shared_examples_for "ruby version conflicts" do
it "raises an error during resolution" do
+ skip "ruby requirement includes platform and it shouldn't" if Gem.win_platform?
+
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
source "http://localgemserver.test/"
ruby #{ruby_requirement}
@@ -164,9 +218,9 @@ RSpec.describe "bundle install with install-time dependencies" do
nice_error = strip_whitespace(<<-E).strip
Bundler found conflicting requirements for the Ruby\0 version:
In Gemfile:
- Ruby\0 (#{error_message_requirement})
+ Ruby\0 (#{error_message_requirement})#{error_message_platform}
- require_ruby was resolved to 1.0, which depends on
+ require_ruby#{error_message_platform} was resolved to 1.0, which depends on
Ruby\0 (> 9000)
Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
@@ -179,7 +233,7 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a < requirement" do
let(:ruby_requirement) { %("< 5000") }
- let(:error_message_requirement) { "< 5000" }
+ let(:error_message_requirement) { Gem::Requirement.new(["< 5000", "= #{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"]).to_s }
it_behaves_like "ruby version conflicts"
end
@@ -187,7 +241,7 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a compound requirement" do
let(:reqs) { ["> 0.1", "< 5000"] }
let(:ruby_requirement) { reqs.map(&:dump).join(", ") }
- let(:error_message_requirement) { Gem::Requirement.new(reqs).to_s }
+ let(:error_message_requirement) { Gem::Requirement.new(reqs + ["= #{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"]).to_s }
it_behaves_like "ruby version conflicts"
end
diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb
index f1d5c8b505..c7c9d2a6a9 100644
--- a/spec/install/gems/standalone_spec.rb
+++ b/spec/install/gems/standalone_spec.rb
@@ -21,9 +21,7 @@ RSpec.shared_examples "bundle install --standalone" do
testrb << "\nrequire \"#{k}\""
testrb << "\nputs #{k.upcase}"
end
- Dir.chdir(bundled_app) do
- ruby testrb, :no_lib => true
- end
+ ruby testrb, :no_lib => true
expect(out).to eq(expected_gems.values.join("\n"))
end
@@ -40,9 +38,7 @@ RSpec.shared_examples "bundle install --standalone" do
testrb << "\nrequire \"#{k}\""
testrb << "\nputs #{k.upcase}"
end
- Dir.chdir("#{bundled_app}2") do
- ruby testrb, :no_lib => true
- end
+ ruby testrb, :no_lib => true, :dir => "#{bundled_app}2"
expect(out).to eq(expected_gems.values.join("\n"))
end
@@ -54,7 +50,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
end
let(:expected_gems) do
@@ -69,7 +65,7 @@ RSpec.shared_examples "bundle install --standalone" do
describe "with gems with native extension", :ruby_repo do
before do
- install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
source "#{file_uri_for(gem_repo1)}"
gem "very_simple_binary"
G
@@ -102,7 +98,7 @@ RSpec.shared_examples "bundle install --standalone" do
end
G
end
- install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
gem "bar", :git => "#{lib_path("bar-1.0")}"
G
end
@@ -122,7 +118,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rails"
gem "devise", :git => "#{lib_path("devise-1.0")}"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
end
let(:expected_gems) do
@@ -149,7 +145,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rack-test"
end
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
end
let(:expected_gems) do
@@ -162,88 +158,63 @@ RSpec.shared_examples "bundle install --standalone" do
include_examples "common functionality"
it "allows creating a standalone file with limited groups" do
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => "default")
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => "default", :dir => cwd)
- Dir.chdir(bundled_app) do
- load_error_ruby <<-RUBY, "spec", :no_lib => true
- $:.unshift File.expand_path("bundle")
- require "bundler/setup"
+ load_error_ruby <<-RUBY, "spec", :no_lib => true
+ $:.unshift File.expand_path("bundle")
+ require "bundler/setup"
- require "actionpack"
- puts ACTIONPACK
- require "spec"
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ require "spec"
+ RUBY
expect(out).to eq("2.3.2")
expect(err).to eq("ZOMG LOAD ERROR")
end
it "allows --without to limit the groups used in a standalone" do
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle"), :without => "test").merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle"), :without => "test").merge(:standalone => true, :dir => cwd)
- Dir.chdir(bundled_app) do
- load_error_ruby <<-RUBY, "spec", :no_lib => true
- $:.unshift File.expand_path("bundle")
- require "bundler/setup"
+ load_error_ruby <<-RUBY, "spec", :no_lib => true
+ $:.unshift File.expand_path("bundle")
+ require "bundler/setup"
- require "actionpack"
- puts ACTIONPACK
- require "spec"
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ require "spec"
+ RUBY
expect(out).to eq("2.3.2")
expect(err).to eq("ZOMG LOAD ERROR")
end
- it "allows --path to change the location of the standalone bundle", :bundler => "< 3" do
- bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true)
+ it "allows --path to change the location of the standalone bundle" do
+ bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true, :dir => cwd)
- Dir.chdir(bundled_app) do
- ruby <<-RUBY, :no_lib => true
- $:.unshift File.expand_path("path/to/bundle")
- require "bundler/setup"
+ ruby <<-RUBY, :no_lib => true
+ $:.unshift File.expand_path("path/to/bundle")
+ require "bundler/setup"
- require "actionpack"
- puts ACTIONPACK
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ RUBY
expect(out).to eq("2.3.2")
end
- it "allows --path to change the location of the standalone bundle", :bundler => "3" do
- bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true)
- path = File.expand_path("path/to/bundle")
-
- Dir.chdir(bundled_app) do
- ruby <<-RUBY, :no_lib => true
- $:.unshift File.expand_path(#{path.dump})
- require "bundler/setup"
-
- require "actionpack"
- puts ACTIONPACK
- RUBY
- end
+ it "allows remembered --without to limit the groups used in a standalone" do
+ bundle! :install, forgotten_command_line_options(:without => "test").merge(:dir => cwd)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
- expect(out).to eq("2.3.2")
- end
+ load_error_ruby <<-RUBY, "spec", :no_lib => true
+ $:.unshift File.expand_path("bundle")
+ require "bundler/setup"
- it "allows remembered --without to limit the groups used in a standalone" do
- bundle! :install, forgotten_command_line_options(:without => "test")
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
-
- Dir.chdir(bundled_app) do
- load_error_ruby <<-RUBY, "spec", :no_lib => true
- $:.unshift File.expand_path("bundle")
- require "bundler/setup"
-
- require "actionpack"
- puts ACTIONPACK
- require "spec"
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ require "spec"
+ RUBY
expect(out).to eq("2.3.2")
expect(err).to eq("ZOMG LOAD ERROR")
@@ -255,11 +226,13 @@ RSpec.shared_examples "bundle install --standalone" do
describe "simple gems" do
before do
+ skip "artifice issues maybe" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rails"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :artifice => "endpoint")
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :artifice => "endpoint", :dir => cwd)
end
let(:expected_gems) do
@@ -279,7 +252,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :binstubs => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :binstubs => true, :dir => cwd)
end
let(:expected_gems) do
@@ -292,21 +265,21 @@ RSpec.shared_examples "bundle install --standalone" do
include_examples "common functionality"
it "creates stubs that use the standalone load path" do
- Dir.chdir(bundled_app) do
- expect(`bin/rails -v`.chomp).to eql "2.3.2"
- end
+ skip "exec format error" if Gem.win_platform?
+
+ expect(sys_exec("bin/rails -v").chomp).to eql "2.3.2"
end
it "creates stubs that can be executed from anywhere" do
+ skip "exec format error" if Gem.win_platform?
+
require "tmpdir"
- Dir.chdir(Dir.tmpdir) do
- sys_exec!(%(#{bundled_app("bin/rails")} -v))
- expect(out).to eq("2.3.2")
- end
+ sys_exec!(%(#{bundled_app("bin/rails")} -v), :dir => Dir.tmpdir)
+ expect(out).to eq("2.3.2")
end
it "creates stubs that can be symlinked" do
- pending "File.symlink is unsupported on Windows" if Bundler::WINDOWS
+ skip "symlinks unsupported" if Gem.win_platform?
symlink_dir = tmp("symlink")
FileUtils.mkdir_p(symlink_dir)
@@ -325,13 +298,13 @@ RSpec.shared_examples "bundle install --standalone" do
end
RSpec.describe "bundle install --standalone" do
+ let(:cwd) { bundled_app }
+
include_examples("bundle install --standalone")
end
RSpec.describe "bundle install --standalone run in a subdirectory" do
- before do
- Dir.chdir(bundled_app("bob").tap(&:mkpath))
- end
+ let(:cwd) { bundled_app("bob").tap(&:mkpath) }
include_examples("bundle install --standalone")
end
diff --git a/spec/install/gems/win32_spec.rb b/spec/install/gems/win32_spec.rb
index 01edcca803..972a455bee 100644
--- a/spec/install/gems/win32_spec.rb
+++ b/spec/install/gems/win32_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundle install with win32-generated lockfile" do
it "should read lockfile" do
- File.open(bundled_app("Gemfile.lock"), "wb") do |f|
+ File.open(bundled_app_lock, "wb") do |f|
f << "GEM\r\n"
f << " remote: #{file_uri_for(gem_repo1)}/\r\n"
f << " specs:\r\n"
diff --git a/spec/install/gemspecs_spec.rb b/spec/install/gemspecs_spec.rb
index 4c00caa60c..048987af9b 100644
--- a/spec/install/gemspecs_spec.rb
+++ b/spec/install/gemspecs_spec.rb
@@ -28,6 +28,8 @@ RSpec.describe "bundle install" do
end
it "should use gemspecs in the system cache when available" do
+ skip "weird incompatible marshal file format error" if Gem.win_platform?
+
gemfile <<-G
source "http://localtestserver.gem"
gem 'rack'
diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index cc8bf70b03..1b32991fa8 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -5,16 +5,17 @@ RSpec.describe "bundle install" do
it "displays the revision hash of the gem repository", :bundler => "< 3" do
build_git "foo", "1.0", :path => lib_path("foo")
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo")}"
+ install_gemfile! <<-G
+ gem "foo", :git => "#{file_uri_for(lib_path("foo"))}"
G
- bundle! :install
- expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at master@#{revision_for(lib_path("foo"))[0..6]})")
+ expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master@#{revision_for(lib_path("foo"))[0..6]})")
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
end
it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 3" do
+ skip "maybe branch~num notation doesn't work on Windows' git" if Gem.win_platform?
+
build_git "foo", "1.0", :path => lib_path("foo")
rev = revision_for(lib_path("foo"))[0..6]
update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true
@@ -22,17 +23,16 @@ RSpec.describe "bundle install" do
update_git "foo", "3.0", :path => lib_path("foo"), :gemspec => true
install_gemfile! <<-G
- gem "foo", :git => "#{lib_path("foo")}", :ref => "master~2"
+ gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "master~2"
G
- bundle! :install
- expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at master~2@#{rev})")
+ expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev})")
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true
bundle! :update, :all => true
- expect(out).to include("Using foo 2.0 (was 1.0) from #{lib_path("foo")} (at master~2@#{rev2})")
+ expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev2})")
expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}"
end
@@ -69,10 +69,10 @@ RSpec.describe "bundle install" do
build_git "gems", :path => lib_path("gems"), :gemspec => false
end
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo2)}"
- gem "foo", :git => "#{lib_path("gems")}", :glob => "foo/*.gemspec"
- gem "zebra", :git => "#{lib_path("gems")}", :glob => "zebra/*.gemspec"
+ gem "foo", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "foo/*.gemspec"
+ gem "zebra", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "zebra/*.gemspec"
G
bundle "info foo"
diff --git a/spec/install/global_cache_spec.rb b/spec/install/global_cache_spec.rb
index 023e52b060..15987bdf53 100644
--- a/spec/install/global_cache_spec.rb
+++ b/spec/install/global_cache_spec.rb
@@ -16,6 +16,8 @@ RSpec.describe "global gem caching" do
end
it "caches gems into the global cache on download" do
+ skip "corrupt test gem" if Gem.win_platform?
+
install_gemfile! <<-G, :artifice => "compact_index"
source "#{source}"
gem "rack"
@@ -38,6 +40,10 @@ RSpec.describe "global gem caching" do
end
describe "when the same gem from different sources is installed" do
+ before do
+ skip "corrupt test gem" if Gem.win_platform?
+ end
+
it "should use the appropriate one from the global cache" do
install_gemfile! <<-G, :artifice => "compact_index"
source "#{source}"
@@ -134,6 +140,8 @@ RSpec.describe "global gem caching" do
describe "when installing gems from a different directory" do
it "uses the global cache as a source" do
+ skip "corrupt test gem" if Gem.win_platform?
+
install_gemfile! <<-G, :artifice => "compact_index"
source "#{source}"
gem "rack"
@@ -161,34 +169,34 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source_global_cache("activesupport-2.3.5.gem")).to exist
- Dir.chdir bundled_app2 do
- create_file bundled_app2("gems.rb"), <<-G
- source "#{source}"
- gem "activesupport"
- G
-
- # Neither gem is installed and both are in the global cache
- expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(the_bundle).not_to include_gems "activesupport 2.3.5"
- expect(source_global_cache("rack-1.0.0.gem")).to exist
- expect(source_global_cache("activesupport-2.3.5.gem")).to exist
-
- # Install using the global cache instead of by downloading the .gem
- # from the server
- bundle! :install, :artifice => "compact_index_no_gem"
-
- # activesupport is installed and both are in the global cache
- expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(the_bundle).to include_gems "activesupport 2.3.5"
- expect(source_global_cache("rack-1.0.0.gem")).to exist
- expect(source_global_cache("activesupport-2.3.5.gem")).to exist
- end
+ create_file bundled_app2("gems.rb"), <<-G
+ source "#{source}"
+ gem "activesupport"
+ G
+
+ # Neither gem is installed and both are in the global cache
+ expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2
+ expect(the_bundle).not_to include_gems "activesupport 2.3.5", :dir => bundled_app2
+ expect(source_global_cache("rack-1.0.0.gem")).to exist
+ expect(source_global_cache("activesupport-2.3.5.gem")).to exist
+
+ # Install using the global cache instead of by downloading the .gem
+ # from the server
+ bundle! :install, :artifice => "compact_index_no_gem", :dir => bundled_app2
+
+ # activesupport is installed and both are in the global cache
+ expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2
+ expect(the_bundle).to include_gems "activesupport 2.3.5", :dir => bundled_app2
+ expect(source_global_cache("rack-1.0.0.gem")).to exist
+ expect(source_global_cache("activesupport-2.3.5.gem")).to exist
end
end
end
describe "extension caching", :ruby_repo do
it "works" do
+ skip "gets incorrect ref in path" if Gem.win_platform?
+
build_git "very_simple_git_binary", &:add_c_extension
build_lib "very_simple_path_binary", &:add_c_extension
revision = revision_for(lib_path("very_simple_git_binary-1.0"))[0, 12]
diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb
index 5240c5820c..bed28ed3e2 100644
--- a/spec/install/path_spec.rb
+++ b/spec/install/path_spec.rb
@@ -22,10 +22,8 @@ RSpec.describe "bundle install" do
dir = bundled_app("bun++dle")
dir.mkpath
- Dir.chdir(dir) do
- bundle! :install, forgotten_command_line_options(:path => dir.join("vendor/bundle"))
- expect(out).to include("installed into `./vendor/bundle`")
- end
+ bundle! :install, forgotten_command_line_options(:path => dir.join("vendor/bundle")).merge(:dir => dir)
+ expect(out).to include("installed into `./vendor/bundle`")
dir.rmtree
end
@@ -54,30 +52,24 @@ RSpec.describe "bundle install" do
before { bundle! "config set path_relative_to_cwd true" }
it "installs the bundle relatively to current working directory", :bundler => "< 3" do
- Dir.chdir(bundled_app.parent) do
- bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle"
- expect(out).to include("installed into `./vendor/bundle`")
- expect(bundled_app("../vendor/bundle")).to be_directory
- end
+ bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle", :dir => bundled_app.parent
+ expect(out).to include("installed into `./vendor/bundle`")
+ expect(bundled_app("../vendor/bundle")).to be_directory
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "installs the standalone bundle relative to the cwd" do
- Dir.chdir(bundled_app.parent) do
- bundle! :install, :gemfile => bundled_app("Gemfile"), :standalone => true
- expect(out).to include("installed into `./bundled_app/bundle`")
- expect(bundled_app("bundle")).to be_directory
- expect(bundled_app("bundle/ruby")).to be_directory
- end
+ bundle! :install, :gemfile => bundled_app_gemfile, :standalone => true, :dir => bundled_app.parent
+ expect(out).to include("installed into `./bundled_app/bundle`")
+ expect(bundled_app("bundle")).to be_directory
+ expect(bundled_app("bundle/ruby")).to be_directory
bundle! "config unset path"
- Dir.chdir(bundled_app("subdir").tap(&:mkpath)) do
- bundle! :install, :gemfile => bundled_app("Gemfile"), :standalone => true
- expect(out).to include("installed into `../bundle`")
- expect(bundled_app("bundle")).to be_directory
- expect(bundled_app("bundle/ruby")).to be_directory
- end
+ bundle! :install, :gemfile => bundled_app_gemfile, :standalone => true, :dir => bundled_app("subdir").tap(&:mkpath)
+ expect(out).to include("installed into `../bundle`")
+ expect(bundled_app("bundle")).to be_directory
+ expect(bundled_app("bundle/ruby")).to be_directory
end
end
end
@@ -137,9 +129,7 @@ RSpec.describe "bundle install" do
set_bundle_path(type, "vendor")
FileUtils.mkdir_p bundled_app("lol")
- Dir.chdir(bundled_app("lol")) do
- bundle! :install
- end
+ bundle! :install, :dir => bundled_app("lol")
expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -203,9 +193,7 @@ RSpec.describe "bundle install" do
describe "to a file" do
before do
- in_app_root do
- FileUtils.touch "bundle"
- end
+ FileUtils.touch bundled_app("bundle")
end
it "reports the file exists" do