diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 06:09:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 06:09:25 +0000 |
commit | 3d064c737e8448880e6180aeddc59000a01aa6a8 (patch) | |
tree | c97dcfe02e48426f96865068ffe8dcdd17bb1a96 /spec/helpers | |
parent | 7ba5b9babaa5802c39e686c57cbf4a3f4725c4b0 (diff) | |
download | gitlab-ce-3d064c737e8448880e6180aeddc59000a01aa6a8.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index 38ad11846d2..7eb5d2fc08c 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -303,4 +303,46 @@ describe IssuablesHelper do end end end + + describe '#gitlab_team_member_badge' do + let(:issue) { build(:issue, author: user) } + + before do + allow(Gitlab).to receive(:com?).and_return(true) + end + + context 'when `:gitlab_employee_badge` feature flag is disabled' do + let(:user) { build(:user, email: 'test@gitlab.com') } + + before do + stub_feature_flags(gitlab_employee_badge: false) + end + + it 'returns nil' do + expect(helper.gitlab_team_member_badge(issue.author)).to be_nil + end + end + + context 'when issue author is not a GitLab team member' do + let(:user) { build(:user, email: 'test@example.com') } + + it 'returns nil' do + expect(helper.gitlab_team_member_badge(issue.author)).to be_nil + end + end + + context 'when issue author is a GitLab team member' do + let(:user) { build(:user, email: 'test@gitlab.com') } + + it 'returns span with svg icon' do + expect(helper.gitlab_team_member_badge(issue.author)).to have_selector('span > svg') + end + + context 'when `css_class` parameter is passed' do + it 'adds CSS classes' do + expect(helper.gitlab_team_member_badge(issue.author, css_class: 'foo bar baz')).to have_selector('span.foo.bar.baz') + end + end + end + end end |