Commit 51e934956a6f41374cdba721b63a64babbe0a16d
1 parent
38f01f5c
Exists in
master
and in
29 other branches
Revert "ActionItem1146: limit must be a number, or nil"
This reverts commit 38f01f5cbaa709bf65b1a824e8447bf509c3f045.
Showing
4 changed files
with
1 additions
and
14 deletions
Show diff stats
app/models/recent_documents_block.rb
@@ -12,7 +12,7 @@ class RecentDocumentsBlock < Block | @@ -12,7 +12,7 @@ class RecentDocumentsBlock < Block | ||
12 | _('This block lists your recent content.') | 12 | _('This block lists your recent content.') |
13 | end | 13 | end |
14 | 14 | ||
15 | - settings_items :limit, :type => :integer, :default => 5 | 15 | + settings_items :limit |
16 | 16 | ||
17 | include ActionController::UrlWriter | 17 | include ActionController::UrlWriter |
18 | def content | 18 | def content |
lib/acts_as_having_settings.rb
@@ -31,7 +31,6 @@ module ActsAsHavingSettings | @@ -31,7 +31,6 @@ module ActsAsHavingSettings | ||
31 | val.nil? ? (#{default}.is_a?(String) ? gettext(#{default}) : #{default}) : val | 31 | val.nil? ? (#{default}.is_a?(String) ? gettext(#{default}) : #{default}) : val |
32 | end | 32 | end |
33 | def #{setting}=(value) | 33 | def #{setting}=(value) |
34 | - value = nil if (value.is_a?(String) && value.blank?) | ||
35 | send(self.class.settings_field)[:#{setting}] = self.class.acts_as_having_settings_type_cast(value, #{data_type.inspect}) | 34 | send(self.class.settings_field)[:#{setting}] = self.class.acts_as_having_settings_type_cast(value, #{data_type.inspect}) |
36 | end | 35 | end |
37 | CODE | 36 | CODE |
test/unit/acts_as_having_settings_test.rb
@@ -7,7 +7,6 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase | @@ -7,7 +7,6 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase | ||
7 | settings_items :flag, :type => :boolean | 7 | settings_items :flag, :type => :boolean |
8 | settings_items :flag_disabled_by_default, :type => :boolean, :default => false | 8 | settings_items :flag_disabled_by_default, :type => :boolean, :default => false |
9 | settings_items :name, :type => :string, :default => N_('ENGLISH TEXT') | 9 | settings_items :name, :type => :string, :default => N_('ENGLISH TEXT') |
10 | - settings_items :number, :type => :integer | ||
11 | end | 10 | end |
12 | 11 | ||
13 | should 'store settings in a hash' do | 12 | should 'store settings in a hash' do |
@@ -75,10 +74,4 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase | @@ -75,10 +74,4 @@ class ActsAsHavingSettingsTest < Test::Unit::TestCase | ||
75 | assert_equal true, obj.flag | 74 | assert_equal true, obj.flag |
76 | end | 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 | end | 77 | end |
test/unit/recent_documents_block_test.rb
@@ -44,11 +44,6 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase | @@ -44,11 +44,6 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase | ||
44 | assert_no_match /href=.*\/testinguser\/first/, output | 44 | assert_no_match /href=.*\/testinguser\/first/, output |
45 | end | 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 | should 'display a link to sitemap with title "All content"' do | 47 | should 'display a link to sitemap with title "All content"' do |
53 | expects(:link_to).with('All content', :controller => 'profile', :action => 'sitemap', :profile => profile.identifier) | 48 | expects(:link_to).with('All content', :controller => 'profile', :action => 'sitemap', :profile => profile.identifier) |
54 | expects(:_).with('All content').returns('All content') | 49 | expects(:_).with('All content').returns('All content') |