Sha256: cc6ddf422e16a1fc0de5c589d3e7eeb7f080b91d5e3ed25fcf1a76ea48e39fe7

Contents?: true

Size: 772 Bytes

Versions: 2

Compression:

Stored size: 772 Bytes

Contents

require 'spec_helper'

describe Wukong::Processor 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)    { [['', '2'], ['1', '1'], ['5', '1'], ['10', '1'], ['100', '1']] }
    it "will group single values" do
      processor(:group).given(*strings.sort).should emit_tsv(*grouped_strings)
    end
    it "can group from within a JSON hash" do
      proc = processor(:group, by: 'data.n').given(*json_sorted_n).should emit_tsv(*grouped_nums)
    end
    it "can group from within a TSV row" do
      proc = processor(:group, by: '3').given(*tsv_sorted).should emit_tsv(*grouped_nums)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wukong-3.0.0.pre3 spec/wukong/widget/reducers/group_spec.rb
wukong-3.0.0.pre2 spec/wukong/widget/reducers/group_spec.rb