Sha256: fd98cd3a74b933792bf3da4760a4e55f6005e8f9c08b542d83d4f520ded16fb1

Contents?: true

Size: 537 Bytes

Versions: 4

Compression:

Stored size: 537 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_not :mysql do
          sql.should be_like(%Q{COUNT("users"."id") AS "alias"})
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arel-0.2.1 spec/arel/engines/sql/unit/primitives/expression_spec.rb
arel-0.2.0 spec/arel/engines/sql/unit/primitives/expression_spec.rb
arel-0.2.pre spec/arel/engines/sql/unit/primitives/expression_spec.rb
arel-0.1.2 spec/arel/engines/sql/unit/primitives/expression_spec.rb