Sha256: 5d79df4c7c88737257355b47611ddee3ee29d8f558fef7013fba2fd94ef2a5e8

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 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 => [{:time => 1, :b => "b"}, {:time => 2, :b => "b"}]},
        {:a => "via_reader", :as => [{:time => 3, :b => "b"}]},
      ]}
  
      subject{ operator.to_a.sort{|k1,k2| k1[:a] <=> k2[:a]} }
  
      describe "without --allbut" do
  
        describe "when factored with commandline args" do
          let(:operator){ Group.run(["--", "time", "b", "as"]) }
          before{ operator.pipe(input) }
          it { should == expected }
        end
    
        describe "when factored with Lispy" do
          let(:operator){ Lispy.group(input, [:time, :b], :as) }
          it { should == expected }
        end
        
      end
  
      describe "with --allbut" do
          
        describe "when factored with commandline args" do
          let(:operator){ Group.run(["--","a", "as"]) }
          before{ operator.allbut = true; operator.pipe(input) }
          it { should == expected }
        end
    
        describe "when factored with Lispy" do
          let(:operator){ Lispy.group(input, [:a], :as, true) }
          it { should == expected }
        end
        
      end
  
    end 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-0.9.0 spec/operator/relational/group_spec.rb