From c4fe95aa93ebf7b19c5b2aaa20240bf5c35b2f59 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Wed, 3 Apr 2013 21:46:20 -0300 Subject: [PATCH] Fixing conflicting link_to_article method signature --- app/helpers/application_helper.rb | 4 ++-- app/helpers/content_viewer_helper.rb | 2 +- test/unit/application_helper_test.rb | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e51b9a3..2421c14 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -951,7 +951,7 @@ module ApplicationHelper # This method was created to work around to inexplicable # chain of problems when display_short_format was called # from Article model for an ArticleBlock. - def link_to_article(text, article, anchor=nil) + def reference_to_article(text, article, anchor=nil) if article.profile.domains.empty? href = "/#{article.url[:profile]}/" else @@ -969,7 +969,7 @@ module ApplicationHelper article.lead + content_tag('div', (options[:comments_link] ? link_to_comments(article) : '') + - (options[:read_more_link] ? link_to_article( _('Read more'), article) : ''), + (options[:read_more_link] ? reference_to_article( _('Read more'), article) : ''), :class => 'read-more' ), :class => 'short-post' diff --git a/app/helpers/content_viewer_helper.rb b/app/helpers/content_viewer_helper.rb index a976ff4..fc4644c 100644 --- a/app/helpers/content_viewer_helper.rb +++ b/app/helpers/content_viewer_helper.rb @@ -37,7 +37,7 @@ module ContentViewerHelper def link_to_comments(article, args = {}) return '' unless article.accept_comments? - link_to_article number_of_comments(article), article, 'comments_list' + reference_to_article number_of_comments(article), article, 'comments_list' end def article_translations(article) diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index 3af2278..5b6a8d6 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -657,33 +657,33 @@ class ApplicationHelperTest < ActiveSupport::TestCase assert_not_nil add_zoom_to_images end - should 'link to article' do + should 'reference to article' do c = fast_create(Community) a = fast_create(TinyMceArticle, :profile_id => c.id) assert_equal( "x", - link_to_article('x', a) ) + reference_to_article('x', a) ) end - should 'link to article, with anchor' do + should 'reference to article, with anchor' do c = fast_create(Community) a = fast_create(TinyMceArticle, :profile_id => c.id) assert_equal( "x", - link_to_article('x', a, 'place') ) + reference_to_article('x', a, 'place') ) end - should 'link to article, in a blog' do + should 'reference to article, in a blog' do c = fast_create(Community) b = fast_create(Blog, :profile_id => c.id) a = fast_create(TinyMceArticle, :profile_id => c.id, :parent_id => b.id) a.save! # needed to link to the parent blog assert_equal( "x", - link_to_article('x', a) ) + reference_to_article('x', a) ) end - should 'link to article, in a profile with domain' do + should 'reference to article, in a profile with domain' do c = fast_create(Community) c.domains << Domain.new(:name=>'domain.xyz') b = fast_create(Blog, :profile_id => c.id) @@ -691,7 +691,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase a.save! assert_equal( "x", - link_to_article('x', a) ) + reference_to_article('x', a) ) end protected -- libgit2 0.21.2