diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-01-10 09:56:42 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-01-12 20:46:33 +0100 |
commit | 7dc38a75680f991bf32320cca850c32d1dcd90ca (patch) | |
tree | e532f1f4eb42a0b9f438ef40380a1ab9ae810975 /spec/commands/show_spec.rb | |
parent | 55630c23f4e0683e820116af917888cf23569020 (diff) | |
download | bundler-7dc38a75680f991bf32320cca850c32d1dcd90ca.tar.gz |
Remove global directory switching from specstests/less_flakyness
`Dir.chdir` is not thread safe, so it makes our parallel specs flaky.
Instead, use the following alternatives:
* Use `:chdir` parameter to `Open3` methods for specs that shell out.
* Stub `find_gemfile` or other relevant helpers for unit tests.
Diffstat (limited to 'spec/commands/show_spec.rb')
-rw-r--r-- | spec/commands/show_spec.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index 3a1fcc1a7a..7b329c8e7f 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do end it "creates a Gemfile.lock if one did not exist" do - FileUtils.rm("Gemfile.lock") + FileUtils.rm(bundled_app_lock) bundle! "show" @@ -18,7 +18,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do end it "creates a Gemfile.lock when invoked with a gem name" do - FileUtils.rm("Gemfile.lock") + FileUtils.rm(bundled_app_lock) bundle! "show rails" @@ -143,13 +143,12 @@ RSpec.describe "bundle show", :bundler => "< 3" do context "in a fresh gem in a blank git repo" do before :each do build_git "foo", :path => lib_path("foo") - Dir.chdir lib_path("foo") - File.open("Gemfile", "w") {|f| f.puts "gemspec" } - sys_exec "rm -rf .git && git init" + File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts "gemspec" } + sys_exec "rm -rf .git && git init", :dir => lib_path("foo") end it "does not output git errors" do - bundle :show + bundle :show, :dir => lib_path("foo") expect(err_without_deprecations).to be_empty end end |