Sha256: 066763f85ac95a5141d0be5e2c8902a71e6f03bff77c74363e4ea6ad24310019

Contents?: true

Size: 1012 Bytes

Versions: 7

Compression:

Stored size: 1012 Bytes

Contents

require 'spec_helper'
module Alf
  describe Lispy, "Relation(...)" do
    let(:lispy){ Alf.lispy }
    subject{ lispy.Relation(*args) }

    describe 'on a single tuple' do
      let(:args){ [{:name => "Alf"}] }
      it{ should eq(Relation[*args]) }
    end

    describe 'on two tuples' do
      let(:args){ [{:name => "Alf"}, {:name => "Lispy"}] }
      it{ should eq(Relation[*args]) }
    end

    describe 'on a Symbol' do
      let(:args){ [:suppliers] }
      specify{ 
        subject.should eq(lispy.environment.dataset(:suppliers).to_rel) 
      }
    end

    describe "on the documentation example" do
      specify {
        lispy.evaluate{
          Relation(
            Tuple(:pid => 'P1', :name => 'Nut',   :color => 'red',   :heavy => true ),
            Tuple(:pid => 'P2', :name => 'Bolt',  :color => 'green', :heavy => false),
            Tuple(:pid => 'P3', :name => 'Screw', :color => 'blue',  :heavy => false)
          )      
        }.should be_a(Relation)
      }
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alf-0.12.2 spec/integration/lispy/test_relation.rb
alf-0.12.1 spec/integration/lispy/test_relation.rb
alf-0.12.0 spec/integration/lispy/test_relation.rb
alf-0.11.1 spec/integration/lispy/test_relation.rb
alf-0.11.0 spec/integration/lispy/test_relation.rb
alf-0.10.1 spec/unit/lispy/test_relation.rb
alf-0.10.0 spec/unit/lispy/test_relation.rb