Sha256: bed35ce9d0e7b9cc48f79e387440d7017774ca4a63aae453db7830931c716464

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

require 'spec_helper'
module Alf
  describe Lispy do
    include Lispy

    let(:input){[
      {:tested => 1,  :other => "b"},
      {:tested => 30, :other => "a"},
    ]}

    let(:expected){[
      {:tested => 30, :other => "a", :upcase => "A"},
    ]}

    it "should allow chaining operators 'ala' LISP" do
      operator = (extend \
                   (restrict input, lambda{ tested > 10 }),
                   :upcase => lambda{ other.upcase })
      operator.to_a.should == expected
    end

    it "should allow building aggregators" do
      sum{ qty }.should be_a(Aggregator::Sum)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alf-0.11.0 spec/integration/test_lispy.rb
alf-0.10.1 spec/unit/test_lispy.rb
alf-0.10.0 spec/unit/test_lispy.rb