Commit de2962ec authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-fix-special-role-error-500' into 'master'

Fix first-time contributor notes not rendering

Closes #65383

See merge request gitlab-org/gitlab-ce!31340
parents 6e47403a 3d9c28af
......@@ -27,6 +27,10 @@ class Note < ApplicationRecord
def values
constants.map {|const| self.const_get(const)}
end
def value?(val)
values.include?(val)
end
end
end
......
---
title: Fix first-time contributor notes not rendering
merge_request: 31340
author:
type: fixed
......@@ -913,6 +913,22 @@ describe Note do
end
end
describe '#special_role=' do
let(:role) { Note::SpecialRole::FIRST_TIME_CONTRIBUTOR }
it 'assigns role' do
subject.special_role = role
expect(subject.special_role).to eq(role)
end
it 'does not assign unknown role' do
expect { subject.special_role = :bogus }.to raise_error(/Role is undefined/)
expect(subject.special_role).to be_nil
end
end
describe '#parent' do
it 'returns project for project notes' do
project = create(:project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment