Sha256: 62902800b6336b3dd3cd1d309a913f9be18fe53905dc9f8692a051b5d7bb9193

Contents?: true

Size: 698 Bytes

Versions: 13

Compression:

Stored size: 698 Bytes

Contents

require 'spec_helper'

module Arel
  describe Value do
    before do
      @relation = Table.new(:users)
    end

    describe '#to_sql' do
      it "appropriately quotes the value" do
        Value.new(1, @relation).to_sql.should be_like('1')

        adapter_is_not :postgresql do
          Value.new('asdf', @relation).to_sql.should be_like("'asdf'")
        end

        adapter_is :postgresql do
          Value.new('asdf', @relation).to_sql.should be_like("E'asdf'")
        end
      end
    end

    describe '#format' do
      it "returns the sql of the provided object" do
        Value.new(1, @relation).format(@relation[:id]).should == @relation[:id].to_sql
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
arel-1.0.1 spec/engines/sql/unit/primitives/value_spec.rb
arel-1.0.0 spec/engines/sql/unit/primitives/value_spec.rb
arel-1.0.0.rc1 spec/engines/sql/unit/primitives/value_spec.rb
arel-compat-0.4.0 spec/engines/sql/unit/primitives/value_spec.rb
arel-0.4.0 spec/engines/sql/unit/primitives/value_spec.rb
arel-0.3.3 spec/engines/sql/unit/primitives/value_spec.rb
arel-0.3.2 spec/engines/sql/unit/primitives/value_spec.rb
arel-0.3.1 spec/arel/engines/sql/unit/primitives/value_spec.rb
arel-0.3.0 spec/arel/engines/sql/unit/primitives/value_spec.rb
arel-0.2.1 spec/arel/engines/sql/unit/primitives/value_spec.rb
arel-0.2.0 spec/arel/engines/sql/unit/primitives/value_spec.rb
arel-0.2.pre spec/arel/engines/sql/unit/primitives/value_spec.rb
arel-0.1.2 spec/arel/engines/sql/unit/primitives/value_spec.rb