Commit 07a88040 authored by Robert Speicher's avatar Robert Speicher

Fix NotificationService spec

parent 682ec038
...@@ -41,10 +41,10 @@ module Gitlab ...@@ -41,10 +41,10 @@ module Gitlab
# #
# type - Singular Symbol reference type (e.g., :issue, :user, etc.) # type - Singular Symbol reference type (e.g., :issue, :user, etc.)
# value - Object to add # value - Object to add
def push_result(type, value) def push_result(type, *values)
return if value.nil? return if values.empty?
result[:references][type].push(value) result[:references][type].push(*values)
end end
def reference_class(type) def reference_class(type)
......
...@@ -45,7 +45,7 @@ module Gitlab ...@@ -45,7 +45,7 @@ module Gitlab
if user == 'all' if user == 'all'
# FIXME (rspeicher): Law of Demeter # FIXME (rspeicher): Law of Demeter
push_result(:user, project.team.members.flatten) push_result(:user, *project.team.members.flatten)
url = link_to_all(project) url = link_to_all(project)
...@@ -53,7 +53,7 @@ module Gitlab ...@@ -53,7 +53,7 @@ module Gitlab
elsif namespace = Namespace.find_by(path: user) elsif namespace = Namespace.find_by(path: user)
if namespace.is_a?(Group) if namespace.is_a?(Group)
if user_can_reference_group?(namespace) if user_can_reference_group?(namespace)
push_result(:user, namespace.users) push_result(:user, *namespace.users)
url = group_url(user, only_path: context[:only_path]) url = group_url(user, only_path: context[:only_path])
%(<a href="#{url}" class="#{klass}">@#{user}</a>) %(<a href="#{url}" class="#{klass}">@#{user}</a>)
......
...@@ -38,7 +38,7 @@ module Gitlab::Markdown ...@@ -38,7 +38,7 @@ module Gitlab::Markdown
it 'adds to the results hash' do it 'adds to the results hash' do
result = pipeline_result('Hey @all') result = pipeline_result('Hey @all')
expect(result[:references][:user]).to eq [[project.creator]] expect(result[:references][:user]).to eq [project.creator]
end end
end end
...@@ -90,7 +90,7 @@ module Gitlab::Markdown ...@@ -90,7 +90,7 @@ module Gitlab::Markdown
it 'adds to the results hash' do it 'adds to the results hash' do
result = pipeline_result("Hey #{reference}", current_user: user) result = pipeline_result("Hey #{reference}", current_user: user)
expect(result[:references][:user]).to eq [group.users] expect(result[:references][:user]).to eq group.users
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment