Sha256: 00cef90e7a414bbb717aa192cfc16d51d1095c8d0ed902d286eeb78d8cb2792c

Contents?: true

Size: 818 Bytes

Versions: 8

Compression:

Stored size: 818 Bytes

Contents

require 'spec_helper'
module Alf
  class Aggregator
    describe Concat do

      let(:rel){[
        {:qty => 10}, 
        {:qty => 20},
        {:qty => 30},
        {:qty => 40}
      ]}

      it 'should work when used standalone' do
        Concat.new{ qty }.aggregate([]).should eq("")
        Concat.new{ qty }.aggregate(rel).should eq("10203040")
      end

      it 'should install factory methods' do
        Aggregator.concat{ qty }.should be_a(Concat)
        Aggregator.concat{ qty }.aggregate(rel).should eq("10203040")
      end

      it 'should work with options' do
        options = {:before => "bef", :after => "aft", :between => " bet "}
        expected = "bef10 bet 20 bet 30 bet 40aft"
        Aggregator.concat(options){ qty }.aggregate(rel).should eq(expected)
      end

    end
  end
end 

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
alf-core-0.14.0 spec/unit/alf-aggregator/test_concat.rb
alf-core-0.13.1 spec/unit/alf-aggregator/test_concat.rb
alf-core-0.13.0 spec/unit/alf-aggregator/test_concat.rb
alf-0.12.2 spec/unit/alf-core/aggregator/test_concat.rb
alf-0.12.1 spec/unit/alf-core/aggregator/test_concat.rb
alf-0.12.0 spec/unit/alf-core/aggregator/test_concat.rb
alf-0.11.1 spec/unit/alf-core/aggregator/test_concat.rb
alf-0.11.0 spec/unit/alf-core/aggregator/test_concat.rb