diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-12 14:55:31 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-12 14:55:31 -0700 |
commit | 196b4e05b7390ac31e12a17ae224b1cf35e4becd (patch) | |
tree | bc5a5e56f8311bd68feb628d89a04e845585f3b5 /spec/arel/attributes_spec.rb | |
parent | 1036749e394e5f7f039e75cdec7675f9ca5047b0 (diff) | |
download | rails-196b4e05b7390ac31e12a17ae224b1cf35e4becd.tar.gz rails-196b4e05b7390ac31e12a17ae224b1cf35e4becd.tar.bz2 rails-196b4e05b7390ac31e12a17ae224b1cf35e4becd.zip |
tables can fetch attributes
Diffstat (limited to 'spec/arel/attributes_spec.rb')
-rw-r--r-- | spec/arel/attributes_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/arel/attributes_spec.rb b/spec/arel/attributes_spec.rb new file mode 100644 index 0000000000..8b437dff9b --- /dev/null +++ b/spec/arel/attributes_spec.rb @@ -0,0 +1,41 @@ +require 'spec_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).should == Attributes::String + end + end + + it 'returns the correct constant for ints' do + column = Struct.new(:type).new :integer + Attributes.for(column).should == Attributes::Integer + end + + it 'returns the correct constant for floats' do + column = Struct.new(:type).new :float + Attributes.for(column).should == Attributes::Float + end + + it 'returns the correct constant for decimals' do + column = Struct.new(:type).new :decimal + Attributes.for(column).should == Attributes::Decimal + end + + it 'returns the correct constant for boolean' do + column = Struct.new(:type).new :boolean + Attributes.for(column).should == 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).should == Attributes::Time + end + end + end + end +end |