diff --git a/app/models/profile_list_block.rb b/app/models/profile_list_block.rb index a2224db..450d33b 100644 --- a/app/models/profile_list_block.rb +++ b/app/models/profile_list_block.rb @@ -21,7 +21,7 @@ class ProfileListBlock < Block end def randomizer - @randomizer ||= "(profiles.id % #{rand(profile_count)})" + @randomizer ||= "(profiles.id % #{rand(profile_count + 1)})" end # the title of the block. Probably will be overriden in subclasses. diff --git a/test/unit/profile_list_block_test.rb b/test/unit/profile_list_block_test.rb index 1eb8a39..9d50df8 100644 --- a/test/unit/profile_list_block_test.rb +++ b/test/unit/profile_list_block_test.rb @@ -153,7 +153,7 @@ class ProfileListBlockTest < Test::Unit::TestCase should 'randomize using modulo operator and random number' do block = ProfileListBlock.new block.expects(:profile_count).returns(10) - block.expects(:rand).with(10).returns(5) + block.expects(:rand).with(11).returns(5) assert_match /profiles.id % 5/, block.randomizer end -- libgit2 0.21.2