Sha256: 32221c379a8306f32d135b4fc2361dbf18598babcf371f514cb8d2cff8051dcc

Contents?: true

Size: 654 Bytes

Versions: 9

Compression:

Stored size: 654 Bytes

Contents

require 'spec_helper'

module Arel
  describe Expression do
    before do
      @relation = Table.new(:users)
      @attribute = @relation[:id]
    end

    describe '#to_sql' do
      it "manufactures sql with the expression and alias" do
        sql = Count.new(@attribute, :alias).to_sql

        adapter_is :mysql do
          sql.should be_like(%Q{COUNT(`users`.`id`) AS `alias`})
        end

        adapter_is :oracle do
          sql.should be_like(%Q{COUNT("USERS"."ID") AS "ALIAS"})
        end

        adapter_is_not :mysql, :oracle do
          sql.should be_like(%Q{COUNT("users"."id") AS "alias"})
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
arel-1.0.1 spec/engines/sql/unit/primitives/expression_spec.rb
arel-1.0.0 spec/engines/sql/unit/primitives/expression_spec.rb
arel-1.0.0.rc1 spec/engines/sql/unit/primitives/expression_spec.rb
arel-compat-0.4.0 spec/engines/sql/unit/primitives/expression_spec.rb
arel-0.4.0 spec/engines/sql/unit/primitives/expression_spec.rb
arel-0.3.3 spec/engines/sql/unit/primitives/expression_spec.rb
arel-0.3.2 spec/engines/sql/unit/primitives/expression_spec.rb
arel-0.3.1 spec/arel/engines/sql/unit/primitives/expression_spec.rb
arel-0.3.0 spec/arel/engines/sql/unit/primitives/expression_spec.rb