diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-21 03:09:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-21 03:09:18 +0300 |
commit | 1ccf61bdccd3f0cbcabd7fe335542014f465f46b (patch) | |
tree | f6eb90ccf27bb2193251d1617e7b655429eb2ac6 /spec/controllers/projects/issues_controller_spec.rb | |
parent | 68f1860e6f1f9e8441c434f4e62238c359ce8c7c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects/issues_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 806a4e2f52c..add7778b57a 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -1390,6 +1390,61 @@ describe Projects::IssuesController do expect(note_json['author']['status_tooltip_html']).to be_present end + context 'is_gitlab_employee attribute' do + subject { get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } } + + before do + allow(Gitlab).to receive(:com?).and_return(true) + note_user = discussion.author + note_user.update(email: email) + note_user.confirm + end + + shared_examples 'non inclusion of gitlab employee badge' do + it 'does not render the is_gitlab_employee attribute' do + subject + + note_json = json_response.first['notes'].first + + expect(note_json['author']['is_gitlab_employee']).to be nil + end + end + + context 'when user is a gitlab employee' do + let(:email) { 'test@gitlab.com' } + + it 'renders the is_gitlab_employee attribute' do + subject + + note_json = json_response.first['notes'].first + + expect(note_json['author']['is_gitlab_employee']).to be true + end + + context 'when feature flag is disabled' do + before do + stub_feature_flags(gitlab_employee_badge: false) + end + + it_behaves_like 'non inclusion of gitlab employee badge' + end + end + + context 'when user is not a gitlab employee' do + let(:email) { 'test@example.com' } + + it_behaves_like 'non inclusion of gitlab employee badge' + + context 'when feature flag is disabled' do + before do + stub_feature_flags(gitlab_employee_badge: false) + end + + it_behaves_like 'non inclusion of gitlab employee badge' + end + end + end + it 'does not cause an extra query for the status' do control = ActiveRecord::QueryRecorder.new do get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } |