Sha256: bbea1437016761c7f7d2d5f024eefc902c4f533ff14ae28a9d48700e1c72d913
Contents?: true
Size: 399 Bytes
Versions: 22
Compression:
Stored size: 399 Bytes
Contents
require 'rspec' require 'enumerable_ext' describe Enumerable do describe '#stable_sort' do it 'sorts stably' do xs = [-2, 2, 1, -1] result = xs.stable_sort{|a, b| a.abs <=> b.abs} expected_result = [1, -1, -2, 2] expect(result).to eql expected_result end it 'does not require a block' do expect([3, 2, 1].stable_sort).to eql [1, 2, 3] end end end
Version data entries
22 entries across 22 versions & 1 rubygems