diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 23:10:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 23:10:52 +0000 |
commit | e3a5a36fc818cc968eef59817df859eb175fb5b2 (patch) | |
tree | 4c8f6321cabd6b7d3c3d0c10389ea977b6204744 /spec/models/merge_request_spec.rb | |
parent | eb4a3b6ed231e0bda2ae746c895073148a03b1ba (diff) | |
download | gitlab-ce-e3a5a36fc818cc968eef59817df859eb175fb5b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-ee
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r-- | spec/models/merge_request_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 2e2355ba710..a3c0c9a0a74 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -4239,10 +4239,14 @@ RSpec.describe MergeRequest, factory_default: :keep, feature_category: :code_rev subject { create(:merge_request, source_project: project) } - it 'fetches the ref correctly' do + it 'fetches the ref and expires the ancestor cache' do expect { subject.target_project.repository.delete_refs(subject.ref_path) }.not_to raise_error + expect(project.repository).to receive(:expire_ancestor_cache).with(subject.target_branch_sha, subject.diff_head_sha).and_call_original + expect(subject).to receive(:expire_ancestor_cache).and_call_original + subject.fetch_ref! + expect(subject.target_project.repository.ref_exists?(subject.ref_path)).to be_truthy end end @@ -4253,7 +4257,8 @@ RSpec.describe MergeRequest, factory_default: :keep, feature_category: :code_rev # We use build instead of create to test that an IID is allocated subject { build(:merge_request, source_project: project) } - it 'fetches the ref correctly' do + it 'fetches the ref and expires the ancestor cache' do + expect(subject).to receive(:expire_ancestor_cache).and_call_original expect(subject.iid).to be_nil expect { subject.eager_fetch_ref! }.to change { subject.iid.to_i }.by(1) |