Sha256: ccb64ee905bf9173f21937727a892517aee910afde340be45a548071a148b6a7

Contents?: true

Size: 1.13 KB

Versions: 74

Compression:

Stored size: 1.13 KB

Contents

require 'helper'

module Arel
  module Visitors
    describe 'the informix visitor' do
      before do
        @visitor = Informix.new Table.engine.connection
      end

      it 'uses LIMIT n to limit results' do
        stmt = Nodes::SelectStatement.new
        stmt.limit = Nodes::Limit.new(1)
        sql = @visitor.accept(stmt)
        sql.must_be_like "SELECT LIMIT 1"
      end

      it 'uses LIMIT n in updates with a limit' do
        stmt = Nodes::UpdateStatement.new
        stmt.limit = Nodes::Limit.new(1)
        stmt.key = 'id'
        sql = @visitor.accept(stmt)
        sql.must_be_like "UPDATE NULL WHERE 'id' IN (SELECT LIMIT 1 'id')"
      end

      it 'uses SKIP n to jump results' do
        stmt = Nodes::SelectStatement.new
        stmt.offset = Nodes::Offset.new(10)
        sql = @visitor.accept(stmt)
        sql.must_be_like "SELECT SKIP 10"
      end

      it 'uses SKIP before LIMIT' do
        stmt = Nodes::SelectStatement.new
        stmt.limit = Nodes::Limit.new(1)
        stmt.offset = Nodes::Offset.new(1)
        sql = @visitor.accept(stmt)
        sql.must_be_like "SELECT SKIP 1 LIMIT 1"
      end

    end
  end
end

Version data entries

74 entries across 61 versions & 11 rubygems

Version Path
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/arel-3.0.2/test/visitors/test_informix.rb
swipe-rails-0.0.5 vendor/bundle/gems/arel-3.0.2/test/visitors/test_informix.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
challah-1.0.0.beta3 vendor/bundle/gems/arel-3.0.2/test/visitors/test_informix.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
challah-1.0.0.beta2 vendor/bundle/gems/arel-3.0.2/test/visitors/test_informix.rb
challah-1.0.0.beta vendor/bundle/gems/arel-3.0.2/test/visitors/test_informix.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
active_mailer-0.0.4 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
active_mailer-0.0.3 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/arel-3.0.2/test/visitors/test_informix.rb
challah-0.9.1.beta.3 vendor/bundle/gems/arel-3.0.2/test/visitors/test_informix.rb
devise_sociable-0.1.0 vendor/bundle/gems/arel-3.0.2/test/visitors/test_informix.rb
challah-0.9.1.beta vendor/bundle/gems/arel-3.0.2/test/visitors/test_informix.rb