Sha256: 923cbdf4a8e98c0477972e15ca7f1e9b437d7ad2b4c217dd86ed8d335567ef2c

Contents?: true

Size: 1003 Bytes

Versions: 6

Compression:

Stored size: 1003 Bytes

Contents

require 'spec_helper'
module Alf
  module Operator::Relational
    describe Ungroup do
        
      let(:operator_class){ Ungroup }
      it_should_behave_like("An operator class")
        
      let(:input) {[
        {:a => "via_method", :as => [{:time => 1, :b => "b"}, {:time => 2, :b => "b"}]},
        {:a => "via_reader", :as => [{:time => 3, :b => "b"}]},
      ]}
  
      let(:expected) {[
        {:a => "via_method", :time => 1, :b => "b"},
        {:a => "via_method", :time => 2, :b => "b"},
        {:a => "via_reader", :time => 3, :b => "b"},
      ]}
  
      subject{ operator.to_a.sort{|k1,k2| k1[:time] <=> k2[:time]} } 
  
      describe "when factored with commandline args" do
        let(:operator) { Ungroup.run(%w{-- as}) } 
        before{ operator.pipe(input) }
        it { should == expected }
      end
  
      describe "when factored with Lispy" do
        let(:operator) { Lispy.ungroup(input, :as) } 
        it { should == expected }
      end
  
    end 
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alf-0.10.1 spec/unit/operator/relational/test_ungroup.rb
alf-0.10.0 spec/unit/operator/relational/test_ungroup.rb
alf-0.9.3 spec/unit/operator/relational/test_ungroup.rb
alf-0.9.2 spec/unit/operator/relational/test_ungroup.rb
alf-0.9.1 spec/unit/operator/relational/test_ungroup.rb
alf-0.9.0 spec/operator/relational/ungroup_spec.rb