summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-07-25 11:42:42 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2017-08-16 14:09:50 -0400
commit5b930d792be4ad26557bb546239eae8a7cf6bed2 (patch)
treee4d9d4bc2076f17b0a3b83ac40ee4a7bdde7e0ea
parentb054108107d54b068a175a3df57043fc55154649 (diff)
downloadbundler-5b930d792be4ad26557bb546239eae8a7cf6bed2.tar.gz
Update specs for thor handling file clashes
-rw-r--r--lib/bundler/cli/gem.rb7
-rw-r--r--spec/commands/newgem_spec.rb10
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 5ebaf189e9..a18d929791 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -142,9 +142,10 @@ module Bundler
end
executables.each do |file|
- path = target.join(file)
- executable = (path.stat.mode | 0o111)
- path.chmod(executable)
+ SharedHelpers.filesystem_access(target.join(file)) do |path|
+ executable = (path.stat.mode | 0o111)
+ path.chmod(executable)
+ end
end
if Bundler.git_present?
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 8543989ca2..8d851f28a4 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -888,19 +888,19 @@ Usage: "bundle gem GEM [OPTIONS]"
FileUtils.touch("conflict-foobar")
end
bundle "gem conflict-foobar"
- expect(last_command.bundler_err).to include("Errno::EEXIST")
+ expect(last_command.bundler_err).to include("Errno::ENOTDIR")
expect(exitstatus).to eql(32) if exitstatus
end
end
context "on conflicts with a previously created directory" do
- it "should fail gracefully" do
+ it "should succeed" do
in_app_root do
FileUtils.mkdir_p("conflict-foobar/Gemfile")
end
- bundle "gem conflict-foobar"
- expect(last_command.bundler_err).to include("Errno::EISDIR")
- expect(exitstatus).to eql(32) if exitstatus
+ bundle! "gem conflict-foobar"
+ expect(last_command.stdout).to include("file_clash conflict-foobar/Gemfile").
+ and include "Initializing git repo in #{bundled_app("conflict-foobar")}"
end
end
end