summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-04 06:12:19 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-05 15:24:49 +0100
commit1daae58d9a139425d6a0a4d940b04ad3af08bb9f (patch)
tree22ee4bcfedb01df575baa44379343a14c611da37 /spec/support
parentf1f8800634e04cff6b89fa14b451d1c3121d0a49 (diff)
downloadbundler-1daae58d9a139425d6a0a4d940b04ad3af08bb9f.tar.gz
Extract `in_repo_root`
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers.rb2
-rw-r--r--spec/support/path.rb8
2 files changed, 7 insertions, 3 deletions
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 9431f83230..0d4d2d53c8 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -297,7 +297,7 @@ module Spec
def with_built_bundler
with_root_gemspec do |gemspec|
- Dir.chdir(root) { gem_command! :build, gemspec.to_s }
+ in_repo_root { gem_command! :build, gemspec.to_s }
end
bundler_path = root + "bundler-#{Bundler::VERSION}.gem"
diff --git a/spec/support/path.rb b/spec/support/path.rb
index 69a4720512..9596724cc0 100644
--- a/spec/support/path.rb
+++ b/spec/support/path.rb
@@ -158,8 +158,8 @@ module Spec
def with_root_gemspec
if ruby_core?
root_gemspec = root.join("bundler.gemspec")
- # Dir.chdir(root) for Dir.glob in gemspec
- spec = Dir.chdir(root) { Gem::Specification.load(gemspec.to_s) }
+ # `in_repo_root` for Dir.glob in gemspec
+ spec = in_repo_root { Gem::Specification.load(gemspec.to_s) }
spec.bindir = "libexec"
File.open(root_gemspec.to_s, "w") {|f| f.write spec.to_ruby }
yield(root_gemspec)
@@ -188,6 +188,10 @@ module Spec
Dir.chdir(bundled_app2, &blk)
end
+ def in_repo_root(&blk)
+ Dir.chdir(root, &blk)
+ end
+
extend self
private