Commit 51e934956a6f41374cdba721b63a64babbe0a16d

Authored by Antonio Terceiro
1 parent 38f01f5c

Revert "ActionItem1146: limit must be a number, or nil"

This reverts commit 38f01f5cbaa709bf65b1a824e8447bf509c3f045.
app/models/recent_documents_block.rb
... ... @@ -12,7 +12,7 @@ class RecentDocumentsBlock < Block
12 12 _('This block lists your recent content.')
13 13 end
14 14  
15   - settings_items :limit, :type => :integer, :default => 5
  15 + settings_items :limit
16 16  
17 17 include ActionController::UrlWriter
18 18 def content
... ...
lib/acts_as_having_settings.rb
... ... @@ -31,7 +31,6 @@ module ActsAsHavingSettings
31 31 val.nil? ? (#{default}.is_a?(String) ? gettext(#{default}) : #{default}) : val
32 32 end
33 33 def #{setting}=(value)
34   - value = nil if (value.is_a?(String) && value.blank?)
35 34 send(self.class.settings_field)[:#{setting}] = self.class.acts_as_having_settings_type_cast(value, #{data_type.inspect})
36 35 end
37 36 CODE
... ...
test/unit/acts_as_having_settings_test.rb
... ... @@ -7,7 +7,6 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase
7 7 settings_items :flag, :type => :boolean
8 8 settings_items :flag_disabled_by_default, :type => :boolean, :default => false
9 9 settings_items :name, :type => :string, :default => N_('ENGLISH TEXT')
10   - settings_items :number, :type => :integer
11 10 end
12 11  
13 12 should 'store settings in a hash' do
... ... @@ -75,10 +74,4 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase
75 74 assert_equal true, obj.flag
76 75 end
77 76  
78   - should 'store nil when set to empty string' do
79   - obj = TestClass.new
80   - obj.number = ''
81   - assert_nil obj.number
82   - end
83   -
84 77 end
... ...
test/unit/recent_documents_block_test.rb
... ... @@ -44,11 +44,6 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase
44 44 assert_no_match /href=.*\/testinguser\/first/, output
45 45 end
46 46  
47   - should 'have a default limit of items' do
48   - block.limit = nil
49   - assert_equal 5, block.limit
50   - end
51   -
52 47 should 'display a link to sitemap with title "All content"' do
53 48 expects(:link_to).with('All content', :controller => 'profile', :action => 'sitemap', :profile => profile.identifier)
54 49 expects(:_).with('All content').returns('All content')
... ...