Sha256: 0eab296d01a7330fab9767420fd1fe45ba35fc4ffeb4f13ebc5741bed7a0d542
Contents?: true
Size: 843 Bytes
Versions: 5
Compression:
Stored size: 843 Bytes
Contents
require 'spec_helper' describe "Reducers" do describe :group do include_context "reducers" it_behaves_like 'a processor', :named => :group let(:grouped_strings) { [['apple', 2], ['banana', 1], ['cookie', 1]] } let(:grouped_nums_from_json) { [[nil, 2], [1, 1], [5, 1], [10, 1], [100, 1]] } let(:grouped_nums_from_tsv) { [[nil, 2], ['1', 1], ['5', 1], ['10', 1], ['100', 1]] } it "will group single values" do processor(:group).given(*strings.sort).should emit(*grouped_strings) end it "can group from within a JSON hash" do proc = processor(:group, by: 'data.n').given(*json_sorted_n).should emit(*grouped_nums_from_json) end it "can group from within a TSV row" do proc = processor(:group, by: '3').given(*tsv_sorted).should emit(*grouped_nums_from_tsv) end end end
Version data entries
5 entries across 5 versions & 2 rubygems