Sha256: 2959391c7a4899d1e584a89f2b8a498bb9c66dc3c993b42fee452ec62702bbde

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

require 'spec_helper'
module Alf
  class Predicate
    describe Predicate, "&" do

      let(:left) { Predicate.coerce(x: 2) }

      subject{ left & right }

      before do
        subject.should be_a(Predicate)
      end

      context 'with itself' do
        let(:right){ left }

        it{ should be(left) }
      end

      context 'with the same expression' do
        let(:right){ Predicate.coerce(x: 2) }

        it{ should be(left) }
      end

      context 'with another predicate' do
        let(:right){ Predicate.coerce(y: 3) }

        it 'should be a expected' do
          subject.to_ruby_code.should eq("->(t){ (t.x == 2) && (t.y == 3) }")
        end
      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/predicate/test_bool_and.rb