Sha256: bcd653c64b0439a11b81c91e3be10aba46f375d593fd26b81d1e92c174945e35
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe Alf do let(:lispy){ Alf.lispy(Alf::Environment.examples) } let(:expected){[ {:status => 20, :sid=>"S1", :name=>"Smith", :city=>"London"}, {:status => 20, :sid=>"S4", :name=>"Clark", :city=>"London"} ]} it "should have a version number" do Alf.const_defined?(:VERSION).should be_true end it "should allow running a commandline like command" do op = lispy.run(['restrict', 'suppliers', '--', "city == 'London'"]) op.to_a.should == expected end it "should allow compiling lispy expressions" do lispy.compile{ (restrict :suppliers, lambda{ city == 'London'}) }.to_a.should == expected end it "should allow defining temporary expressions" do lispy.compile{ with(:sup => (dataset :suppliers)) do (restrict :sup, lambda{ city == 'London'}) end }.to_a.should == expected end it "should allow reusing temporary expressions" do op = lispy.compile do (restrict :suppliers, lambda{ status > 20 }) end projection = lispy.with(:kept_suppliers => op) do (project :kept_suppliers, [:city]) end projection.to_a.should == [ {:city => 'Paris'}, {:city => 'Athens'} ] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-0.9.0 | spec/alf_spec.rb |