Commit 486e450c98f4730bd066262e929845ce4baad4fc
1 parent
083d29d3
Exists in
master
and in
29 other branches
blocks: make sure limit is integer on get_limit
Blocks configured before the definition of limit type were strings and were crashing
Showing
2 changed files
with
8 additions
and
1 deletions
Show diff stats
app/models/block.rb
test/unit/block_test.rb
@@ -330,4 +330,11 @@ class BlockTest < ActiveSupport::TestCase | @@ -330,4 +330,11 @@ class BlockTest < ActiveSupport::TestCase | ||
330 | block.save! | 330 | block.save! |
331 | assert !block.display_to_user?(person_friend) | 331 | assert !block.display_to_user?(person_friend) |
332 | end | 332 | end |
333 | + | ||
334 | + should 'get limit as a number when limit is string' do | ||
335 | + block = RecentDocumentsBlock.new | ||
336 | + block.settings[:limit] = '5' | ||
337 | + assert block.get_limit.is_a?(Fixnum) | ||
338 | + end | ||
339 | + | ||
333 | end | 340 | end |