summaryrefslogtreecommitdiff
path: root/spec/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'spec/runtime')
-rw-r--r--spec/runtime/executable_spec.rb10
-rw-r--r--spec/runtime/gem_tasks_spec.rb5
-rw-r--r--spec/runtime/inline_spec.rb32
-rw-r--r--spec/runtime/load_spec.rb4
-rw-r--r--spec/runtime/platform_spec.rb2
-rw-r--r--spec/runtime/setup_spec.rb21
6 files changed, 32 insertions, 42 deletions
diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb
index 96197a52b8..e420594f52 100644
--- a/spec/runtime/executable_spec.rb
+++ b/spec/runtime/executable_spec.rb
@@ -44,14 +44,14 @@ RSpec.describe "Running bin/* commands" do
it "uses the default ruby install name when shebang is not specified" do
bundle! "binstubs rack"
- expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n")
+ expect(File.open(bundled_app("bin/rackup")).gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n")
end
it "allows the name of the shebang executable to be specified" do
skip "not created with custom name :/" if Gem.win_platform?
bundle! "binstubs rack", :shebang => "ruby-foo"
- expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env ruby-foo\n")
+ expect(File.open(bundled_app("bin/rackup")).gets).to eq("#!/usr/bin/env ruby-foo\n")
end
it "runs the bundled command when out of the bundle" do
@@ -63,10 +63,8 @@ RSpec.describe "Running bin/* commands" do
s.executables = "rackup"
end
- Dir.chdir(tmp) do
- gembin "rackup"
- expect(out).to eq("1.0.0")
- end
+ gembin "rackup", :dir => tmp
+ expect(out).to eq("1.0.0")
end
it "works with gems in path" do
diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb
index 91ea5cf189..4fe9d43e73 100644
--- a/spec/runtime/gem_tasks_spec.rb
+++ b/spec/runtime/gem_tasks_spec.rb
@@ -59,15 +59,12 @@ RSpec.describe "require 'bundler/gem_tasks'" do
context "rake build when path has spaces" do
before do
- Dir.chdir(root)
spaced_bundled_app = tmp.join("bundled app")
FileUtils.mv bundled_app, spaced_bundled_app
- Dir.chdir(spaced_bundled_app)
+ bundle! "exec rake build", :dir => spaced_bundled_app
end
it "still runs successfully" do
- bundle! "exec rake build"
-
expect(err).to be_empty
end
end
diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb
index def258ec66..fb6c6e90ad 100644
--- a/spec/runtime/inline_spec.rb
+++ b/spec/runtime/inline_spec.rb
@@ -233,16 +233,14 @@ RSpec.describe "bundler/inline#gemfile" do
1.13.6
G
- in_app_root do
- script <<-RUBY
- gemfile do
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- end
+ script <<-RUBY
+ gemfile do
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ end
- puts RACK
- RUBY
- end
+ puts RACK
+ RUBY
expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
@@ -265,16 +263,14 @@ RSpec.describe "bundler/inline#gemfile" do
it "installs inline gems when BUNDLE_GEMFILE is set to an empty string" do
ENV["BUNDLE_GEMFILE"] = ""
- in_app_root do
- script <<-RUBY
- gemfile do
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- end
+ script <<-RUBY
+ gemfile do
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ end
- puts RACK
- RUBY
- end
+ puts RACK
+ RUBY
expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
diff --git a/spec/runtime/load_spec.rb b/spec/runtime/load_spec.rb
index 7de67e247c..a406fbaf49 100644
--- a/spec/runtime/load_spec.rb
+++ b/spec/runtime/load_spec.rb
@@ -7,6 +7,7 @@ RSpec.describe "Bundler.load" do
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
+ allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app)
end
it "provides a list of the env dependencies" do
@@ -32,6 +33,7 @@ RSpec.describe "Bundler.load" do
gem "rack"
G
bundle! :install
+ allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app)
end
it "provides a list of the env dependencies" do
@@ -101,7 +103,7 @@ RSpec.describe "Bundler.load" do
source "#{file_uri_for(gem_repo1)}"
gem "activerecord"
G
-
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
Bundler.load.specs.each do |spec|
expect(spec.to_yaml).not_to match(/^\s+source:/)
expect(spec.to_yaml).not_to match(/^\s+groups:/)
diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb
index f7e93eacf1..ad9c56d14e 100644
--- a/spec/runtime/platform_spec.rb
+++ b/spec/runtime/platform_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
end
it "allows specifying only-ruby-platform on windows with gemspec dependency" do
- build_lib("foo", "1.0", :path => ".") do |s|
+ build_lib("foo", "1.0", :path => bundled_app) do |s|
s.add_dependency "rack"
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 8c2c55ac5b..f94efbea6a 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -489,15 +489,16 @@ RSpec.describe "Bundler.setup" do
it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
- with_read_only("**/*") do
+ with_read_only("#{bundled_app}/**/*") do
expect(the_bundle).to include_gems "rack 1.0.0"
end
end
it "finds git gem when default bundle path becomes read only" do
+ bundle "config set --local path .bundle"
bundle "install"
- with_read_only("#{Bundler.bundle_path}/**/*") do
+ with_read_only("#{bundled_app(".bundle")}/**/*") do
expect(the_bundle).to include_gems "rack 1.0.0"
end
end
@@ -865,11 +866,9 @@ end
gem 'foo', '1.2.3', :path => 'vendor/foo'
G
- Dir.chdir(bundled_app.parent) do
- run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }
- require 'foo'
- R
- end
+ run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, :dir => bundled_app.parent
+ require 'foo'
+ R
expect(err).to be_empty
end
@@ -889,11 +888,9 @@ end
bundle :install
- Dir.chdir(bundled_app.parent) do
- run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }
- require 'foo'
- R
- end
+ run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, :dir => bundled_app.parent
+ require 'foo'
+ R
expect(err).to be_empty
end