Sha256: e3efdfaf62c8269d1f0a767f6a154170f15ce71cd486b4e4f1a2127e05dc7e2a

Contents?: true

Size: 937 Bytes

Versions: 7

Compression:

Stored size: 937 Bytes

Contents

require 'spec_helper'
module Alf
  describe Lispy, "Tuple(...)" do
    let(:lispy){ Alf.lispy }
    subject{ lispy.Tuple(h) }

    describe 'on an empty tuple' do
      let(:h){ {} }
      it{ should eq({}) }
    end

    describe 'on an valid tuple' do
      let(:h){ {:name => "Alf"} }
      it{ should eq({:name => "Alf"}) }
    end

    describe 'on an invalid tuple because of keys' do
      let(:h){ {12 => "Alf"} }
      specify{ lambda{subject}.should raise_error(ArgumentError) }
    end

    describe 'on an invalid tuple because of values' do
      let(:h){ {:name => nil} }
      specify{ lambda{subject}.should raise_error(ArgumentError) }
    end

    describe "on the documentation example" do
      specify{
        lispy.evaluate{
          Tuple(:pid => 'P1', :name => 'Nut', :color => 'red', :heavy => true)
        }.should eq(:pid => 'P1', :name => 'Nut', :color => 'red', :heavy => true)
      }
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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