Commit a24f068a2cc2ec4e078863d1920481bb79708fd2
1 parent
a38702e3
Exists in
master
and in
29 other branches
array-ext: add test to uniq_by method
Showing
1 changed file
with
11 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | ||
| 2 | + | ||
| 3 | +# tests for Array core extension. See lib/noosfero/core_ext/array.rb | ||
| 4 | +class StringCoreExtTest < ActiveSupport::TestCase | ||
| 5 | + | ||
| 6 | + should 'allow uniq by a block' do | ||
| 7 | + array = [0,1,2,3,4,5,6] | ||
| 8 | + assert_equal [0,1], array.uniq_by {|number| number%2 } | ||
| 9 | + end | ||
| 10 | + | ||
| 11 | +end |