Sha256: c8af41b97db692ca77a3a561a10d8de9e030b119fd7d4d66d546c5564ad94656

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

require 'spec_helper'
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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
predicate-1.0.0 spec/factory/test_factor_predicate.rb