From 1db099271209bc4413ed8040d6b0a5d6366944e8 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 2 Jul 2008 22:02:26 +0000 Subject: [PATCH] ActionItem521: not showing tags block without tags --- app/models/tags_block.rb | 3 +++ test/unit/tags_block_test.rb | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/tags_block.rb b/app/models/tags_block.rb index 0efe43f..12e055e 100644 --- a/app/models/tags_block.rb +++ b/app/models/tags_block.rb @@ -14,6 +14,9 @@ class TagsBlock < Block end def content + tags = owner.tags + return '' if tags.empty? + block_title( _('tags') ) + "\n
\n"+ tag_cloud( owner.tags, :id, diff --git a/test/unit/tags_block_test.rb b/test/unit/tags_block_test.rb index a3e78c6..a1c8f08 100644 --- a/test/unit/tags_block_test.rb +++ b/test/unit/tags_block_test.rb @@ -23,8 +23,9 @@ class TagsBlockTest < Test::Unit::TestCase assert_match /profile\/testinguser\/tag\/third-tag/, block.content end - should 'display owner name in tags' do - assert_match "testinguser's tags", block.content + should 'return (none) when no tags to display' do + block.owner.expects(:tags).returns([]) + assert_equal '', block.content end end -- libgit2 0.21.2