Sha256: dc001bf307e2a07e7c4b5d80ff59e189de9e648eef6f3b6520756fd6ef8b3879

Contents?: true

Size: 961 Bytes

Versions: 13

Compression:

Stored size: 961 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', 'foo'], a: 'b', c: 'd', 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'"

        expect(qs('T', foo_in: %w(bar baz))).to eq "select * from T where foo in ('bar', 'baz')"
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cmis-ruby-0.5.38 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.37 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.36 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.35 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.34 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.33 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.32 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.31 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.30 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.29 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.28 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.27 spec/cmis-ruby/utils_spec.rb
cmis-ruby-0.5.26 spec/cmis-ruby/utils_spec.rb