Sha256: bd4bd98da70e2e6a334c2874e88ccf8a3ca4e6dc5ed911c2e42d2981bb3c0099
Contents?: true
Size: 560 Bytes
Versions: 15
Compression:
Stored size: 560 Bytes
Contents
require 'spec_helper' describe NonSharedAccessors do it 'should count by rule' do array = [ '2', 2, 5, '8', 7, 3, 6, 1, 11 ] expect(array.count_by_rule{|x| x.to_s == ?2 }).to eq({ true => 2, false => 7 }) expect(array.count_by_rule{|x| x == 2 }).to eq({ true => 1, false => 8 }) expect(array.count_by_rule{|x| x.to_i % 2 == 0 }).to eq({ true => 4, false => 5 }) expect(array.count_by_rule{|x| x.to_s.include?(?1) }).to eq({ true => 2, false => 7 }) end end
Version data entries
15 entries across 15 versions & 1 rubygems