diff options
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 |