diff options
author | Ryan Davis <ryand-ruby@zenspider.com> | 2010-10-18 15:41:21 -0700 |
---|---|---|
committer | Ryan Davis <ryand-ruby@zenspider.com> | 2010-10-18 15:41:21 -0700 |
commit | e1ebe6e949ef3674434bfa90d271a7b74c2ac153 (patch) | |
tree | b0c340817d75bddf9840c97a946a7217ff12e8ab /test/test_attributes.rb | |
parent | 7959e55ead84be096247d9622404d1c60ca21c88 (diff) | |
download | rails-e1ebe6e949ef3674434bfa90d271a7b74c2ac153.tar.gz rails-e1ebe6e949ef3674434bfa90d271a7b74c2ac153.tar.bz2 rails-e1ebe6e949ef3674434bfa90d271a7b74c2ac153.zip |
Fisting arel specs -- still needs tree_manager and cleanup
Diffstat (limited to 'test/test_attributes.rb')
-rw-r--r-- | test/test_attributes.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/test_attributes.rb b/test/test_attributes.rb new file mode 100644 index 0000000000..4cdb625b17 --- /dev/null +++ b/test/test_attributes.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).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 |