diff options
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r-- | spec/lib/banzai/reference_parser/user_parser_spec.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/spec/lib/banzai/reference_parser/user_parser_spec.rb b/spec/lib/banzai/reference_parser/user_parser_spec.rb index 931fb1e3953..71d2e1de3b6 100644 --- a/spec/lib/banzai/reference_parser/user_parser_spec.rb +++ b/spec/lib/banzai/reference_parser/user_parser_spec.rb @@ -19,15 +19,23 @@ describe Banzai::ReferenceParser::UserParser do link['data-group'] = project.group.id.to_s end - it 'returns the users of the group' do - create(:group_member, group: group, user: user) - - expect(subject.referenced_by([link])).to eq([user]) - end - it 'returns an empty Array when the group has no users' do expect(subject.referenced_by([link])).to eq([]) end + + context 'when group has members' do + let!(:group_member) { create(:group_member, group: group, user: user) } + + it 'returns the users of the group' do + expect(subject.referenced_by([link])).to eq([user]) + end + + it 'returns an empty Array when the group has mentions disabled' do + group.update!(mentions_disabled: true) + + expect(subject.referenced_by([link])).to eq([]) + end + end end context 'using a non-existing group ID' do |