From 07a88040a405cd1a72baa63c9439c25c513636ae Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 25 Apr 2015 16:46:06 -0400 Subject: [PATCH] Fix NotificationService spec --- lib/gitlab/markdown/reference_filter.rb | 6 +++--- lib/gitlab/markdown/user_reference_filter.rb | 4 ++-- spec/lib/gitlab/markdown/user_reference_filter_spec.rb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/gitlab/markdown/reference_filter.rb b/lib/gitlab/markdown/reference_filter.rb index 2e8baea68d6..42eadf450c7 100644 --- a/lib/gitlab/markdown/reference_filter.rb +++ b/lib/gitlab/markdown/reference_filter.rb @@ -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) diff --git a/lib/gitlab/markdown/user_reference_filter.rb b/lib/gitlab/markdown/user_reference_filter.rb index d3af206335d..b4c48d29684 100644 --- a/lib/gitlab/markdown/user_reference_filter.rb +++ b/lib/gitlab/markdown/user_reference_filter.rb @@ -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]) %(@#{user}) diff --git a/spec/lib/gitlab/markdown/user_reference_filter_spec.rb b/spec/lib/gitlab/markdown/user_reference_filter_spec.rb index f5a14367311..922502ada33 100644 --- a/spec/lib/gitlab/markdown/user_reference_filter_spec.rb +++ b/spec/lib/gitlab/markdown/user_reference_filter_spec.rb @@ -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