Sha256: e7cab01a3cde77e4d9ff78a24ffb390603a0e6ddf52007ad22d03b7e50878bfa

Contents?: true

Size: 844 Bytes

Versions: 25

Compression:

Stored size: 844 Bytes

Contents

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

    subject{ Factory.send(:_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

25 entries across 25 versions & 1 rubygems

Version Path
predicate-1.2.0 spec/factory/test_factor_predicate.rb
predicate-1.1.3 spec/factory/test_factor_predicate.rb
predicate-1.1.2 spec/factory/test_factor_predicate.rb
predicate-1.1.1 spec/factory/test_factor_predicate.rb
predicate-1.1.0 spec/factory/test_factor_predicate.rb