Sha256: 764f4042802d9e05781e75f084372683be70ef5e6c8625ab9c8626828323d669

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

require 'spec_helper'

module CMIS
  describe Utils do
    describe '#build_query_statement' do
      def qs(*args)
        CMIS::Utils.build_query_statement(*args)
      end

      it 'builds the correct query statement' do
        expect(qs('T', {})).to eq 'select * from T'
        expect(qs('T', foo: 'bar')).to eq "select * from T where foo = 'bar'"
        expect(qs('T', bar: 'baz', pif: 'poef')).to eq "select * from T where bar = 'baz' and pif = 'poef'"
        expect(qs('T', foo: { bar: 'baz', pif: 'poef' })).to eq "select * from T join foo as X on cmis:objectId = X.cmis:objectId where bar = 'baz' and pif = 'poef'"
        expect(qs('T', a: 'b', c: 'd', foo: { bar: 'baz', pif: 'poef' })).to eq "select * from T join foo as X on cmis:objectId = X.cmis:objectId where a = 'b' and c = 'd' and bar = 'baz' and pif = 'poef'"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cmis-ruby-0.5.23 spec/cmis-ruby/utils_spec.rb