summaryrefslogtreecommitdiff
path: root/spec/models/merge_request_reviewer_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/merge_request_reviewer_spec.rb')
-rw-r--r--spec/models/merge_request_reviewer_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/merge_request_reviewer_spec.rb b/spec/models/merge_request_reviewer_spec.rb
index d99fd4afb0f..dd00c4d8627 100644
--- a/spec/models/merge_request_reviewer_spec.rb
+++ b/spec/models/merge_request_reviewer_spec.rb
@@ -25,4 +25,24 @@ RSpec.describe MergeRequestReviewer do
it { is_expected.to belong_to(:merge_request).class_name('MergeRequest') }
it { is_expected.to belong_to(:reviewer).class_name('User').inverse_of(:merge_request_reviewers) }
end
+
+ describe '#attention_requested_by' do
+ let(:current_user) { create(:user) }
+
+ before do
+ subject.update!(updated_state_by: current_user)
+ end
+
+ context 'attention requested' do
+ it { expect(subject.attention_requested_by).to eq(current_user) }
+ end
+
+ context 'attention requested' do
+ before do
+ subject.update!(state: :reviewed)
+ end
+
+ it { expect(subject.attention_requested_by).to eq(nil) }
+ end
+ end
end