diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-11-01 18:35:14 +0100 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-11-02 07:14:35 +0100 |
commit | 064c8949bd2cbbd304909b84f4ddac3c80827b94 (patch) | |
tree | 2eda37a87768439b4485dd161b8aa0fe809ad923 /spec/lib/banzai/filter/user_reference_filter_spec.rb | |
parent | 101779e4e9fd83ef1890a7499ef9b2723fb75cbf (diff) | |
download | gitlab-ce-064c8949bd2cbbd304909b84f4ddac3c80827b94.tar.gz |
CE port of code changed for epicsjk-epic-changes-ce-port
Diffstat (limited to 'spec/lib/banzai/filter/user_reference_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/user_reference_filter_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/user_reference_filter_spec.rb b/spec/lib/banzai/filter/user_reference_filter_spec.rb index 34dac1db69a..fc03741976e 100644 --- a/spec/lib/banzai/filter/user_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/user_reference_filter_spec.rb @@ -208,6 +208,39 @@ describe Banzai::Filter::UserReferenceFilter do end end + context 'in group context' do + let(:group) { create(:group) } + let(:group_member) { create(:user) } + + before do + group.add_developer(group_member) + end + + let(:context) { { author: group_member, project: nil, group: group } } + + it 'supports a special @all mention' do + reference = User.reference_prefix + 'all' + doc = reference_filter("Hey #{reference}", context) + + expect(doc.css('a').length).to eq(1) + expect(doc.css('a').first.attr('href')).to eq urls.group_url(group) + end + + it 'supports mentioning a single user' do + reference = group_member.to_reference + doc = reference_filter("Hey #{reference}", context) + + expect(doc.css('a').first.attr('href')).to eq urls.user_url(group_member) + end + + it 'supports mentioning a group' do + reference = group.to_reference + doc = reference_filter("Hey #{reference}", context) + + expect(doc.css('a').first.attr('href')).to eq urls.user_url(group) + end + end + describe '#namespaces' do it 'returns a Hash containing all Namespaces' do document = Nokogiri::HTML.fragment("<p>#{user.to_reference}</p>") |