Sha256: ba9c6c2029b3c48955b96e15317921415a956ce20de033fcdc162e6de6df0379

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'
module Alf
  module Operator::Relational
    describe Group do

      let(:operator_class){ Group }
      it_should_behave_like("An operator class")

      let(:input) {[
        {:a => "via_method", :time => 1, :b => "b"},
        {:a => "via_method", :time => 2, :b => "b"},
        {:a => "via_reader", :time => 3, :b => "b"},
      ]}

      let(:expected) {[
        {:a => "via_method", :as => Alf::Relation[{:time => 1, :b => "b"}, 
                                                  {:time => 2, :b => "b"}]},
        {:a => "via_reader", :as => Alf::Relation[{:time => 3, :b => "b"}]},
      ]}

      subject{ operator.to_a.sort{|k1,k2| k1[:a] <=> k2[:a]} }

      context "--no-allbut" do
        context "with Lispy" do
          let(:operator){ Lispy.group(input, [:time, :b], :as) }
          it { should == expected }
        end
      end # --no-allbut
  
      context "--allbut" do
        context "with Lispy" do
          let(:operator){ Lispy.group(input, [:a], :as, :allbut => true) }
          it { should == expected }
        end
      end # --allbut

    end 
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-core/operator/relational/test_group.rb
alf-0.12.1 spec/unit/alf-core/operator/relational/test_group.rb
alf-0.12.0 spec/unit/alf-core/operator/relational/test_group.rb
alf-0.11.1 spec/unit/alf-core/operator/relational/test_group.rb
alf-0.11.0 spec/unit/alf-core/operator/relational/test_group.rb