Sha256: 32d6e7282464e9d943a672291ce966b1173ddad2683de0197b80b4163ead9be2

Contents?: true

Size: 891 Bytes

Versions: 10

Compression:

Stored size: 891 Bytes

Contents

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

    it 'allowing binding a eq placeholder' do
      p = Predicate.placeholder
      unbound = Predicate.eq(:name, p)
      bind = unbound.bind(p => "blambeau")
      expect(bind).to eql(Predicate.eq(:name, "blambeau"))
    end

    it 'allowing binding an in placeholder' do
      p = Predicate.placeholder
      unbound = Predicate.in(:name, p)
      bind = unbound.bind(p => ["blambeau","llambeau"])
      expect(bind).to eql(Predicate.in(:name, ["blambeau","llambeau"]))
    end

    it 'applies recursively placeholder' do
      p, p2 = Predicate.placeholder, Predicate.placeholder
      unbound = Predicate.eq(:name, p) & Predicate.eq(:last, p2)
      bind = unbound.bind(p => "bernard", p2 => "lambeau")
      expect(bind).to eql(Predicate.eq(:name, "bernard") & Predicate.eq(:last, "lambeau"))
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
predicate-2.8.0 spec/predicate/test_bind.rb
predicate-2.7.1 spec/predicate/test_bind.rb
predicate-2.7.0 spec/predicate/test_bind.rb
predicate-2.6.0 spec/predicate/test_bind.rb
predicate-2.5.0 spec/predicate/test_bind.rb
predicate-2.4.0 spec/predicate/test_bind.rb
predicate-2.3.3 spec/predicate/test_bind.rb
predicate-2.3.2 spec/predicate/test_bind.rb
predicate-2.3.1 spec/predicate/test_bind.rb
predicate-2.3.0 spec/predicate/test_bind.rb