aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema_dumper_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-07-08 20:35:56 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-07-08 20:35:56 +0000
commit2a12b56841bd6fd3998050e7677a1b2c08257479 (patch)
tree4fcd51578ac322228b2f6a44ce2344ab309992aa /activerecord/test/schema_dumper_test.rb
parent71234daef1517cf190adfc5978e56882d2a57ea6 (diff)
downloadrails-2a12b56841bd6fd3998050e7677a1b2c08257479.tar.gz
rails-2a12b56841bd6fd3998050e7677a1b2c08257479.tar.bz2
rails-2a12b56841bd6fd3998050e7677a1b2c08257479.zip
r4704@asus: jeremy | 2006-06-27 12:00:19 -0700
decimal r4705@asus: jeremy | 2006-06-27 12:20:47 -0700 current_adapter? checks whether any of its arguments is the name of the current adapter class r4834@asus: jeremy | 2006-07-08 13:08:24 -0700 Room to float. r4835@asus: jeremy | 2006-07-08 13:09:18 -0700 Give lock test a few chances. r4836@asus: jeremy | 2006-07-08 13:12:05 -0700 Numeric and decimal columns map to BigDecimal instead of Float. Those with scale 0 map to Integer. Closes #5454. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4596 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/schema_dumper_test.rb')
-rw-r--r--activerecord/test/schema_dumper_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/schema_dumper_test.rb b/activerecord/test/schema_dumper_test.rb
index 37e8a99048..21e47ce609 100644
--- a/activerecord/test/schema_dumper_test.rb
+++ b/activerecord/test/schema_dumper_test.rb
@@ -7,6 +7,7 @@ if ActiveRecord::Base.connection.respond_to?(:tables)
class SchemaDumperTest < Test::Unit::TestCase
def standard_dump
stream = StringIO.new
+ ActiveRecord::SchemaDumper.ignore_tables = []
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
stream.string
end
@@ -30,7 +31,7 @@ if ActiveRecord::Base.connection.respond_to?(:tables)
def test_arguments_line_up
output = standard_dump
output.scan(/^( *)create_table.*?\n(.*?)^\1end/m).map{ |m| m.last.split(/\n/) }.each do |column_set|
- assert_line_up(column_set, /:(?:integer|float|datetime|timestamp|time|date|text|binary|string|boolean)/, true)
+ assert_line_up(column_set, /:(?:integer|decimal|float|datetime|timestamp|time|date|text|binary|string|boolean)/, true)
assert_line_up(column_set, /:default => /)
assert_line_up(column_set, /:limit => /)
assert_line_up(column_set, /:null => /)
@@ -82,6 +83,14 @@ if ActiveRecord::Base.connection.respond_to?(:tables)
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
end
end
+
+ def test_schema_dump_includes_decimal_options
+ stream = StringIO.new
+ ActiveRecord::SchemaDumper.ignore_tables = [/^[^n]/]
+ ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
+ output = stream.string
+ assert_match %r{:precision => 3,[[:space:]]+:scale => 2,[[:space:]]+:default => 0.278E1}, output
+ end
end
end