summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-10-06 15:43:48 +0900
committernagachika <nagachika@ruby-lang.org>2022-10-08 12:27:30 +0900
commitd77e6e653d32fa6287286cc68300abc0d1a299da (patch)
tree5eba1ad51312bb634e7660607e6cb699fad54607 /spec
parentd2f4cbf04215e536bcd06fde9cc7cec3b5566707 (diff)
Merge RubyGems-3.3.23 and Bundler-2.3.23
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/init_spec.rb23
-rw-r--r--spec/bundler/spec_helper.rb2
-rw-r--r--spec/bundler/support/path.rb4
3 files changed, 29 insertions, 0 deletions
diff --git a/spec/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb
index eaf8fa170a..9c499b99a1 100644
--- a/spec/bundler/commands/init_spec.rb
+++ b/spec/bundler/commands/init_spec.rb
@@ -7,6 +7,29 @@ RSpec.describe "bundle init" do
expect(bundled_app_gemfile).to be_file
end
+ context "with a template with permission flags not matching current process umask" do
+ let(:template_file) do
+ gemfile = Bundler.preferred_gemfile_name
+ templates_dir.join(gemfile)
+ end
+
+ let(:target_dir) { bundled_app("init_permissions_test") }
+
+ around do |example|
+ old_chmod = File.stat(template_file).mode
+ FileUtils.chmod(old_chmod | 0o111, template_file) # chmod +x
+ example.run
+ FileUtils.chmod(old_chmod, template_file)
+ end
+
+ it "honours the current process umask when generating from a template" do
+ FileUtils.mkdir(target_dir)
+ bundle :init, :dir => target_dir
+ generated_mode = File.stat(File.join(target_dir, "Gemfile")).mode & 0o111
+ expect(generated_mode).to be_zero
+ end
+ end
+
context "when a Gemfile already exists" do
before do
create_file "Gemfile", <<-G
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index 892ad10e98..d606220dc4 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -60,6 +60,8 @@ RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
+
+ c.max_formatted_output_length = 1000
end
config.mock_with :rspec do |mocks|
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index a39e46c78a..7443e78d52 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -312,6 +312,10 @@ module Spec
source_root.join("tool/bundler")
end
+ def templates_dir
+ lib_dir.join("bundler", "templates")
+ end
+
extend self
end
end