From 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 Feb 2021 10:34:06 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-9-stable-ee --- spec/models/merge_request/metrics_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/models/merge_request/metrics_spec.rb') diff --git a/spec/models/merge_request/metrics_spec.rb b/spec/models/merge_request/metrics_spec.rb index 760eaf1ac7f..13ff239a306 100644 --- a/spec/models/merge_request/metrics_spec.rb +++ b/spec/models/merge_request/metrics_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe MergeRequest::Metrics do describe 'associations' do it { is_expected.to belong_to(:merge_request) } + it { is_expected.to belong_to(:target_project).class_name('Project') } it { is_expected.to belong_to(:latest_closed_by).class_name('User') } it { is_expected.to belong_to(:merged_by).class_name('User') } end @@ -36,5 +37,15 @@ RSpec.describe MergeRequest::Metrics do is_expected.not_to include([metrics_2]) end end + + describe '.by_target_project' do + let(:target_project) { metrics_1.target_project } + + subject { described_class.by_target_project(target_project) } + + it 'finds metrics record with the associated target project' do + is_expected.to eq([metrics_1]) + end + end end end -- cgit v1.2.1