From 51e934956a6f41374cdba721b63a64babbe0a16d Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Mon, 6 Jul 2009 14:56:11 -0300 Subject: [PATCH] Revert "ActionItem1146: limit must be a number, or nil" --- app/models/recent_documents_block.rb | 2 +- lib/acts_as_having_settings.rb | 1 - test/unit/acts_as_having_settings_test.rb | 7 ------- test/unit/recent_documents_block_test.rb | 5 ----- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/app/models/recent_documents_block.rb b/app/models/recent_documents_block.rb index 5d22985..0ea4888 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, :type => :integer, :default => 5 + settings_items :limit include ActionController::UrlWriter def content diff --git a/lib/acts_as_having_settings.rb b/lib/acts_as_having_settings.rb index ac5e7b4..4b421f3 100644 --- a/lib/acts_as_having_settings.rb +++ b/lib/acts_as_having_settings.rb @@ -31,7 +31,6 @@ module ActsAsHavingSettings val.nil? ? (#{default}.is_a?(String) ? gettext(#{default}) : #{default}) : val end def #{setting}=(value) - value = nil if (value.is_a?(String) && value.blank?) send(self.class.settings_field)[:#{setting}] = self.class.acts_as_having_settings_type_cast(value, #{data_type.inspect}) end CODE diff --git a/test/unit/acts_as_having_settings_test.rb b/test/unit/acts_as_having_settings_test.rb index 65ee19d..696c394 100644 --- a/test/unit/acts_as_having_settings_test.rb +++ b/test/unit/acts_as_having_settings_test.rb @@ -7,7 +7,6 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase settings_items :flag, :type => :boolean settings_items :flag_disabled_by_default, :type => :boolean, :default => false settings_items :name, :type => :string, :default => N_('ENGLISH TEXT') - settings_items :number, :type => :integer end should 'store settings in a hash' do @@ -75,10 +74,4 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase assert_equal true, obj.flag end - should 'store nil when set to empty string' do - obj = TestClass.new - obj.number = '' - assert_nil obj.number - end - end diff --git a/test/unit/recent_documents_block_test.rb b/test/unit/recent_documents_block_test.rb index 1f91372..183b1df 100644 --- a/test/unit/recent_documents_block_test.rb +++ b/test/unit/recent_documents_block_test.rb @@ -44,11 +44,6 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase assert_no_match /href=.*\/testinguser\/first/, output end - should 'have a default limit of items' do - block.limit = nil - assert_equal 5, block.limit - 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