diff options
Diffstat (limited to 'spec/bundler/gem_helper_spec.rb')
-rw-r--r-- | spec/bundler/gem_helper_spec.rb | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index b27c96b9a5..6af78e00be 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -178,13 +178,11 @@ RSpec.describe Bundler::GemHelper do end before do - Dir.chdir(app_path) do - `git init` - `git config user.email "you@example.com"` - `git config user.name "name"` - `git config commit.gpgsign false` - `git config push.default simple` - end + 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) @@ -198,13 +196,13 @@ RSpec.describe Bundler::GemHelper do end it "when there are uncommitted files" do - Dir.chdir(app_path) { `git add .` } + 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 - Dir.chdir(app_path) { `git commit -a -m "initial commit"` } + sys_exec("git commit -a -m \"initial commit\"", :dir => app_path) expect { Rake.application["release"].invoke }.to raise_error(RuntimeError) end end @@ -213,10 +211,8 @@ RSpec.describe Bundler::GemHelper do let(:repo) { build_git("foo", :bare => true) } before do - Dir.chdir(app_path) do - sys_exec("git remote add origin #{file_uri_for(repo.path)}") - sys_exec('git commit -a -m "initial commit"') - end + 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 @@ -225,7 +221,7 @@ RSpec.describe Bundler::GemHelper do mock_confirm_message "Tagged v#{app_version}." mock_confirm_message "Pushed git commits and tags." - Dir.chdir(app_path) { sys_exec("git push -u origin master") } + sys_exec("git push -u origin master", :dir => app_path) end it "calls rubygem_push with proper arguments" do @@ -246,9 +242,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) - Dir.chdir(app_path) do - `git tag -a -m \"Version #{app_version}\" v#{app_version}` - end + sys_exec("git tag -a -m \"Version #{app_version}\" v#{app_version}", :dir => app_path) Rake.application["release"].invoke end @@ -269,12 +263,10 @@ RSpec.describe Bundler::GemHelper do end before do - Dir.chdir(app_path) do - `git init` - `git config user.email "you@example.com"` - `git config user.name "name"` - `git config push.default simple` - end + 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) |