Sha256: d00193217d3dbe246c4f03b780c980488f3f9b0d96b0a62a7343e9999dc3be89

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'
class Predicate
  describe Predicate, "attr_split" do

    let(:p){ Predicate }
    subject{ pred.attr_split }

    context "on tautology" do
      let(:pred){ p.tautology }

      it{ should eq({}) }
    end

    context "on contradiction" do
      let(:pred){ p.contradiction }

      it{ should eq({ nil => pred }) }
    end

    context "on identifier" do
      let(:pred){ p.identifier(:x) }

      it{ should eq({ x: pred }) }
    end

    context "on not" do
      let(:pred){ p.not(:x) }

      it{ should eq({ x: pred }) }
    end

    context "on eq" do
      let(:pred){ p.eq(:x, 2) }

      it{ should eq({ x: pred }) }
    end

    context "on eq with placeholder" do
      let(:pred){ p.eq(:x, p.placeholder) }

      it{ should eq({ x: pred }) }
    end

    context "on in" do
      let(:pred){ p.in(:x, [2]) }

      it{ should eq({ x: pred }) }
    end

    context "on match" do
      let(:pred){ p.match(:x, "London") }

      it{ should eq({ x: pred }) }
    end

    context "on match with two identifiers" do
      let(:pred){ p.match(:x, :y) }

      it{ should eq({ nil => pred }) }
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
predicate-2.4.0 spec/predicate/test_attr_split.rb
predicate-2.3.3 spec/predicate/test_attr_split.rb
predicate-2.3.2 spec/predicate/test_attr_split.rb
predicate-2.3.1 spec/predicate/test_attr_split.rb
predicate-2.3.0 spec/predicate/test_attr_split.rb