[bundler/bundler] Improve spec to be more realistic

https://github.com/bundler/bundler/commit/ca96316b97
This commit is contained in:
David Rodríguez 2019-06-28 11:06:03 +02:00 коммит произвёл Hiroshi SHIBATA
Родитель 4b1395ab4a
Коммит e6dc7b5b5b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -128,17 +128,18 @@ 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}" }
it "fails gracefully when resetting to the revision fails" do
expect(subject).to receive(:git_retry).with(start_with("clone ")) { destination.mkpath }
expect(subject).to receive(:git_retry).with(start_with("fetch "))
expect(subject).to receive(:git).with("reset --hard #{revision}").and_raise(Bundler::Source::Git::GitCommandError, "command")
expect(subject).to receive(:git).with(command).and_raise(Bundler::Source::Git::GitCommandError, command)
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" \
"Git error: command `git #{command}` in directory #{destination} has failed.\n" \
"Revision #{revision} does not exist in the repository #{uri}. Maybe you misspelled it?" \
)
end