Sha256: a7a50dcb12169433efa7711daca21c0eaee1cde573dbd94bc602401f046c1215
Contents?: true
Size: 412 Bytes
Versions: 4
Compression:
Stored size: 412 Bytes
Contents
require 'test_helper' class SorterTest < ActiveSupport::TestCase class Sorted include CollectionSorter::Sorter sort_with :asc do |coll| coll.sort do |a,b| b[:v] > a[:v] ? -1 : b[:v] == a[:v] ? 0 : 1 end end end test "should sort a collection" do @coll = [{v: 3}, {v: 1}, {v: 2}] assert_equal [{v: 1}, {v: 2}, {v: 3}], Sorted.new.apply_sort(@coll, :asc) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
collection_sorter-0.0.4 | test/sorter_test.rb |
collection_sorter-0.0.3 | test/sorter_test.rb |
collection_sorter-0.0.2 | test/sorter_test.rb |
collection_sorter-0.0.1 | test/sorter_test.rb |