diff options
Diffstat (limited to 'spec/bundler/bundler')
-rw-r--r-- | spec/bundler/bundler/compact_index_client/updater_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/bundler/gem_helper_spec.rb | 10 | ||||
-rw-r--r-- | spec/bundler/bundler/source/git/git_proxy_spec.rb | 8 | ||||
-rw-r--r-- | spec/bundler/bundler/source/git_spec.rb | 4 |
4 files changed, 18 insertions, 8 deletions
diff --git a/spec/bundler/bundler/compact_index_client/updater_spec.rb b/spec/bundler/bundler/compact_index_client/updater_spec.rb index acb312edb3..d8bb15df7e 100644 --- a/spec/bundler/bundler/compact_index_client/updater_spec.rb +++ b/spec/bundler/bundler/compact_index_client/updater_spec.rb @@ -17,7 +17,6 @@ RSpec.describe Bundler::CompactIndexClient::Updater do let(:response) { double(:response, :body => "abc123") } it "treats the response as an update" do - expect(response).to receive(:[]).with("Content-Encoding") { "" } expect(response).to receive(:[]).with("ETag") { nil } expect(fetcher).to receive(:call) { response } @@ -29,8 +28,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do let(:response) { double(:response, :body => "") } it "raises HTTPError" do - expect(response).to receive(:[]).with("Content-Encoding") { "gzip" } - expect(fetcher).to receive(:call) { response } + expect(fetcher).to receive(:call).and_raise(Zlib::GzipFile::Error) expect do updater.update(local_path, remote_path) diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb index 48af7867b4..30befdf40c 100644 --- a/spec/bundler/bundler/gem_helper_spec.rb +++ b/spec/bundler/bundler/gem_helper_spec.rb @@ -256,6 +256,16 @@ RSpec.describe Bundler::GemHelper do Rake.application["release"].invoke end + + 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) + + expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) + + Rake.application["release"].invoke + end end context "on releasing with a custom tag prefix" do diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb index 35702d7763..97f06973cb 100644 --- a/spec/bundler/bundler/source/git/git_proxy_spec.rb +++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb @@ -130,18 +130,20 @@ RSpec.describe Bundler::Source::Git::GitProxy do context "when given a SHA as a revision" do let(:revision) { "abcd" * 10 } let(:command) { ["reset", "--hard", revision] } + let(:command_for_display) { "git #{command.shelljoin}" } it "fails gracefully when resetting to the revision fails" do expect(subject).to receive(:git_retry).with("clone", any_args) { destination.mkpath } expect(subject).to receive(:git_retry).with("fetch", any_args, :dir => destination) - expect(subject).to receive(:git).with(*command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination)) + expect(subject).to receive(:git).with(*command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command_for_display, destination)) expect(subject).not_to receive(:git) expect { subject.copy_to(destination, submodules) }. to raise_error( Bundler::Source::Git::MissingGitRevisionError, - "Git error: command `git #{command}` in directory #{destination} has failed.\n" \ - "Revision #{revision} does not exist in the repository #{uri}. Maybe you misspelled it?" \ + "Git error: command `#{command_for_display}` in directory #{destination} has failed.\n" \ + "Revision #{revision} does not exist in the repository #{uri}. Maybe you misspelled it?\n" \ + "If this error persists you could try removing the cache directory '#{destination}'" ) end end diff --git a/spec/bundler/bundler/source/git_spec.rb b/spec/bundler/bundler/source/git_spec.rb index f7475a35aa..6668b6e69a 100644 --- a/spec/bundler/bundler/source/git_spec.rb +++ b/spec/bundler/bundler/source/git_spec.rb @@ -14,14 +14,14 @@ RSpec.describe Bundler::Source::Git do describe "#to_s" do it "returns a description" do - expect(subject.to_s).to eq "https://github.com/foo/bar.git (at master)" + expect(subject.to_s).to eq "https://github.com/foo/bar.git" end context "when the URI contains credentials" do let(:uri) { "https://my-secret-token:x-oauth-basic@github.com/foo/bar.git" } it "filters credentials" do - expect(subject.to_s).to eq "https://x-oauth-basic@github.com/foo/bar.git (at master)" + expect(subject.to_s).to eq "https://x-oauth-basic@github.com/foo/bar.git" end end end |