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

Fix NotificationService spec

parent 682ec038
......@@ -41,10 +41,10 @@ module Gitlab
#
# type - Singular Symbol reference type (e.g., :issue, :user, etc.)
# value - Object to add
def push_result(type, value)
return if value.nil?
def push_result(type, *values)
return if values.empty?
result[:references][type].push(value)
result[:references][type].push(*values)
end
def reference_class(type)
......
......@@ -45,7 +45,7 @@ module Gitlab
if user == 'all'
# FIXME (rspeicher): Law of Demeter
push_result(:user, project.team.members.flatten)
push_result(:user, *project.team.members.flatten)
url = link_to_all(project)
......@@ -53,7 +53,7 @@ module Gitlab
elsif namespace = Namespace.find_by(path: user)
if namespace.is_a?(Group)
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])
%(<a href="#{url}" class="#{klass}">@#{user}</a>)
......
......@@ -38,7 +38,7 @@ module Gitlab::Markdown
it 'adds to the results hash' do
result = pipeline_result('Hey @all')
expect(result[:references][:user]).to eq [[project.creator]]
expect(result[:references][:user]).to eq [project.creator]
end
end
......@@ -90,7 +90,7 @@ module Gitlab::Markdown
it 'adds to the results hash' do
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
......
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