diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-31 18:09:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-31 18:09:25 +0000 |
commit | 30b8ea126ffffc9bef610d38f8ebcd91bb687aba (patch) | |
tree | 3705b43015a6d3a1fd85864f1fc555383b8e248b /spec/scripts/trigger-build_spec.rb | |
parent | a5519693560d1ac4e120e1afd7d806d13a2d09fd (diff) | |
download | gitlab-ce-30b8ea126ffffc9bef610d38f8ebcd91bb687aba.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/scripts/trigger-build_spec.rb')
-rw-r--r-- | spec/scripts/trigger-build_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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 |