diff options
Diffstat (limited to 'spec/bundler/bundler/gem_helper_spec.rb')
-rw-r--r-- | spec/bundler/bundler/gem_helper_spec.rb | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb index 5cd79de620..940e5df9de 100644 --- a/spec/bundler/bundler/gem_helper_spec.rb +++ b/spec/bundler/bundler/gem_helper_spec.rb @@ -11,6 +11,7 @@ RSpec.describe Bundler::GemHelper do before(:each) do global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false", "BUNDLE_GEM__LINTER" => "false", "BUNDLE_GEM__CI" => "false", "BUNDLE_GEM__CHANGELOG" => "false" + sys_exec("git config --global init.defaultBranch main") bundle "gem #{app_name}" prepare_gemspec(app_gemspec_path) end @@ -252,11 +253,11 @@ RSpec.describe Bundler::GemHelper do end before do - sys_exec("git init", :dir => app_path) - sys_exec("git config user.email \"you@example.com\"", :dir => app_path) - sys_exec("git config user.name \"name\"", :dir => app_path) - sys_exec("git config commit.gpgsign false", :dir => app_path) - sys_exec("git config push.default simple", :dir => app_path) + sys_exec("git init", dir: app_path) + sys_exec("git config user.email \"you@example.com\"", dir: app_path) + sys_exec("git config user.name \"name\"", dir: app_path) + sys_exec("git config commit.gpgsign false", dir: app_path) + sys_exec("git config push.default simple", dir: app_path) # silence messages allow(Bundler.ui).to receive(:confirm) @@ -270,23 +271,23 @@ RSpec.describe Bundler::GemHelper do end it "when there are uncommitted files" do - sys_exec("git add .", :dir => app_path) + sys_exec("git add .", dir: app_path) expect { Rake.application["release"].invoke }. to raise_error("There are files that need to be committed first.") end it "when there is no git remote" do - sys_exec("git commit -a -m \"initial commit\"", :dir => app_path) + sys_exec("git commit -a -m \"initial commit\"", dir: app_path) expect { Rake.application["release"].invoke }.to raise_error(RuntimeError) end end context "succeeds" do - let(:repo) { build_git("foo", :bare => true) } + let(:repo) { build_git("foo", bare: true) } before do - sys_exec("git remote add origin #{file_uri_for(repo.path)}", :dir => app_path) - sys_exec('git commit -a -m "initial commit"', :dir => app_path) + sys_exec("git remote add origin #{file_uri_for(repo.path)}", dir: app_path) + sys_exec('git commit -a -m "initial commit"', dir: app_path) end context "on releasing" do @@ -295,7 +296,7 @@ RSpec.describe Bundler::GemHelper do mock_confirm_message "Tagged v#{app_version}." mock_confirm_message "Pushed git commits and release tag." - sys_exec("git push -u origin master", :dir => app_path) + sys_exec("git push -u origin main", dir: app_path) end it "calls rubygem_push with proper arguments" do @@ -313,8 +314,8 @@ RSpec.describe Bundler::GemHelper do it "also works when releasing from an ambiguous reference" do # Create a branch with the same name as the tag - sys_exec("git checkout -b v#{app_version}", :dir => app_path) - sys_exec("git push -u origin v#{app_version}", :dir => app_path) + sys_exec("git checkout -b v#{app_version}", dir: app_path) + sys_exec("git push -u origin v#{app_version}", dir: app_path) expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) @@ -322,7 +323,7 @@ RSpec.describe Bundler::GemHelper do end it "also works with releasing from a branch not yet pushed" do - sys_exec("git checkout -b module_function", :dir => app_path) + sys_exec("git checkout -b module_function", dir: app_path) expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) @@ -336,7 +337,7 @@ RSpec.describe Bundler::GemHelper do mock_build_message app_name, app_version mock_confirm_message "Pushed git commits and release tag." - sys_exec("git push -u origin master", :dir => app_path) + sys_exec("git push -u origin main", dir: app_path) expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) end @@ -352,7 +353,7 @@ RSpec.describe Bundler::GemHelper do mock_confirm_message "Tag v#{app_version} has already been created." expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) - sys_exec("git tag -a -m \"Version #{app_version}\" v#{app_version}", :dir => app_path) + sys_exec("git tag -a -m \"Version #{app_version}\" v#{app_version}", dir: app_path) Rake.application["release"].invoke end @@ -373,10 +374,10 @@ RSpec.describe Bundler::GemHelper do end before do - sys_exec("git init", :dir => app_path) - sys_exec("git config user.email \"you@example.com\"", :dir => app_path) - sys_exec("git config user.name \"name\"", :dir => app_path) - sys_exec("git config push.gpgsign simple", :dir => app_path) + sys_exec("git init", dir: app_path) + sys_exec("git config user.email \"you@example.com\"", dir: app_path) + sys_exec("git config user.name \"name\"", dir: app_path) + sys_exec("git config push.gpgsign simple", dir: app_path) # silence messages allow(Bundler.ui).to receive(:confirm) |