Sha256: 25b0d0ae1f44d787909de7131677d1d3f32f8ef5c759417a0dfa5bd53be81a9c

Contents?: true

Size: 727 Bytes

Versions: 4

Compression:

Stored size: 727 Bytes

Contents

require 'spec_helper'
module Alf
  describe TupleComputation do

    describe "the class itself" do
      let(:type){ TupleComputation }
      def TupleComputation.exemplars
        [
          {status: 10},
          {big?: "status > 10"}
        ].map{|x| TupleComputation.coerce(x)}
      end
      it_should_behave_like 'A valid type implementation'
    end

    it 'should have a valid example' do
      computation = TupleComputation[
        big?: lambda{ status > 20 },
        who:  lambda{ "#{first} #{last}" }
      ]
      res = computation.call(last: "Jones", first: "Bill", status: 10)
      res.should eq(big?: false, who: "Bill Jones")
    end

    let(:scope){ Support::TupleScope.new(who: "alf") }

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-types/test_tuple_computation.rb
alf-core-0.14.0 spec/unit/alf-types/test_tuple_computation.rb
alf-core-0.13.1 spec/unit/alf-types/test_tuple_computation.rb
alf-core-0.13.0 spec/unit/alf-types/test_tuple_computation.rb