Sha256: 81c22880a2c9b2d4848354bc18b7f64003e2ba3cba6d3170bc01007e86602c12

Contents?: true

Size: 926 Bytes

Versions: 10

Compression:

Stored size: 926 Bytes

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 evaluating lispy expressions" do
    rel = lispy.evaluate {
      (restrict :suppliers, lambda{ city == 'London'})
    }
    rel.should be_a(Alf::Relation)
    rel.should eq(Alf::Relation.coerce(expected))
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
alf-0.12.2 spec/integration/test_alf.rb
alf-0.12.1 spec/integration/test_alf.rb
alf-0.12.0 spec/integration/test_alf.rb
alf-0.11.1 spec/integration/test_alf.rb
alf-0.11.0 spec/integration/test_alf.rb
alf-0.10.1 spec/integration/test_alf.rb
alf-0.10.0 spec/integration/test_alf.rb
alf-0.9.3 spec/integration/test_alf.rb
alf-0.9.2 spec/integration/test_alf.rb
alf-0.9.1 spec/integration/test_alf.rb