From 30b8ea126ffffc9bef610d38f8ebcd91bb687aba Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 31 Oct 2022 18:09:25 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/scripts/trigger-build_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'spec/scripts/trigger-build_spec.rb') diff --git a/spec/scripts/trigger-build_spec.rb b/spec/scripts/trigger-build_spec.rb index ac8e3c7797c..758336d251d 100644 --- a/spec/scripts/trigger-build_spec.rb +++ b/spec/scripts/trigger-build_spec.rb @@ -337,6 +337,29 @@ RSpec.describe Trigger do it 'sets GITLAB_ASSETS_TAG to CI_COMMIT_SHA' do expect(subject.variables['GITLAB_ASSETS_TAG']).to eq(env['CI_COMMIT_SHA']) end + + context 'when cached-assets-hash.txt does not exist' do + before do + expect(File).to receive(:exist?).with('cached-assets-hash.txt').and_return(false) + end + + it 'sets GITLAB_ASSETS_TAG to CI_COMMIT_SHA' do + expect(subject.variables['GITLAB_ASSETS_TAG']).to eq(env['CI_COMMIT_SHA']) + end + end + + context 'when cached-assets-hash.txt exists' do + before do + allow(File).to receive(:exist?).and_call_original + allow(File).to receive(:read).and_call_original + expect(File).to receive(:exist?).with('cached-assets-hash.txt').and_return(true) + expect(File).to receive(:read).with('cached-assets-hash.txt').and_return("42") + end + + it 'sets GITLAB_ASSETS_TAG to CI_COMMIT_SHA' do + expect(subject.variables['GITLAB_ASSETS_TAG']).to eq("assets-hash-42") + end + end end end -- cgit v1.2.1