Sha256: bcacfbd6669f33d5191dfa614e99b891871c4ed6fbcab13c6189bffe1bac770f

Contents?: true

Size: 646 Bytes

Versions: 11

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

11 entries across 11 versions & 1 rubygems

Version Path
predicate-1.3.4 spec/predicate/test_bool_or.rb
predicate-1.3.3 spec/predicate/test_bool_or.rb
predicate-1.3.2 spec/predicate/test_bool_or.rb
predicate-1.3.1 spec/predicate/test_bool_or.rb
predicate-1.3.0 spec/predicate/test_bool_or.rb
predicate-1.2.0 spec/predicate/test_bool_or.rb
predicate-1.1.3 spec/predicate/test_bool_or.rb
predicate-1.1.2 spec/predicate/test_bool_or.rb
predicate-1.1.1 spec/predicate/test_bool_or.rb
predicate-1.1.0 spec/predicate/test_bool_or.rb
predicate-1.0.0 spec/predicate/test_bool_or.rb