Sha256: 345823f2a3bbfd90184fdf9d929ff96af8ec40c53a796f55e945d422b9e0f1f9

Contents?: true

Size: 646 Bytes

Versions: 6

Compression:

Stored size: 646 Bytes

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
predicate-1.2.0 spec/predicate/test_bool_and.rb
predicate-1.1.3 spec/predicate/test_bool_and.rb
predicate-1.1.2 spec/predicate/test_bool_and.rb
predicate-1.1.1 spec/predicate/test_bool_and.rb
predicate-1.1.0 spec/predicate/test_bool_and.rb
predicate-1.0.0 spec/predicate/test_bool_and.rb