From 7f3da1f1f310e50282bf7ef3f5c973a0724e67d5 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Mon, 6 Jul 2009 16:04:49 -0300 Subject: [PATCH] ActionItem1146: limit has a default and must be a number --- app/models/recent_documents_block.rb | 2 +- test/unit/recent_documents_block_test.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/models/recent_documents_block.rb b/app/models/recent_documents_block.rb index 0ea4888..5d22985 100644 --- a/app/models/recent_documents_block.rb +++ b/app/models/recent_documents_block.rb @@ -12,7 +12,7 @@ class RecentDocumentsBlock < Block _('This block lists your recent content.') end - settings_items :limit + settings_items :limit, :type => :integer, :default => 5 include ActionController::UrlWriter def content diff --git a/test/unit/recent_documents_block_test.rb b/test/unit/recent_documents_block_test.rb index 183b1df..d7a4b3c 100644 --- a/test/unit/recent_documents_block_test.rb +++ b/test/unit/recent_documents_block_test.rb @@ -44,6 +44,16 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase assert_no_match /href=.*\/testinguser\/first/, output end + should 'store limit as a number' do + block.limit = '' + assert block.limit.is_a?(Fixnum) + end + + should 'have a non-zero default' do + block.limit = nil + assert block.limit > 0 + end + should 'display a link to sitemap with title "All content"' do expects(:link_to).with('All content', :controller => 'profile', :action => 'sitemap', :profile => profile.identifier) expects(:_).with('All content').returns('All content') -- libgit2 0.21.2