Sha256: 236ab8b6410c23c2527e80481914a4dab53b93e21c336ec9538de9068fd92a73

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'helper'

module Arel
  describe 'Attributes' do
    describe 'for' do
      it 'returns the correct constant for strings' do
        [:string, :text, :binary].each do |type|
          column = Struct.new(:type).new type
          Attributes.for(column).must_equal Attributes::String
        end
      end

      it 'returns the correct constant for ints' do
        column = Struct.new(:type).new :integer
        Attributes.for(column).must_equal Attributes::Integer
      end

      it 'returns the correct constant for floats' do
        column = Struct.new(:type).new :float
        Attributes.for(column).must_equal Attributes::Float
      end

      it 'returns the correct constant for decimals' do
        column = Struct.new(:type).new :decimal
        Attributes.for(column).must_equal Attributes::Decimal
      end

      it 'returns the correct constant for boolean' do
        column = Struct.new(:type).new :boolean
        Attributes.for(column).must_equal Attributes::Boolean
      end

      it 'returns the correct constant for time' do
        [:date, :datetime, :timestamp, :time].each do |type|
          column = Struct.new(:type).new type
          Attributes.for(column).must_equal Attributes::Time
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arel-2.0.2 test/test_attributes.rb