Sha256: 84e59818eae695162ba64853e90850777c8dffcb8e02072de00db9f5142dbad5

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

require 'spec_helper'
module Alf
  class Predicate
    describe Factory, "_factor_predicate" do

      subject{ Factory._factor_predicate(arg) }

      context "on Expr" do
        let(:arg){ Grammar.sexpr([:literal, 12]) }

        it{ should be(arg) }
      end

      context "on true" do
        let(:arg){ true }

        it{ should be_a(Tautology) }
      end

      context "on false" do
        let(:arg){ false }

        it{ should be_a(Contradiction) }
      end

      context "on Symbol" do
        let(:arg){ :name }

        it{ should be_a(Identifier) }
      end

      context "on Proc" do
        let(:arg){ lambda{} }

        it{ should be_a(Native) }
      end

      context "on Array" do
        let(:arg){ [:identifier, :name] }

        it{ should be_a(Identifier) }
      end

      context "on 12" do
        let(:arg){ 12 }

        it{ should be_a(Literal) }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-predicate/factory/test_factor_predicate.rb