aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-06-12 06:56:51 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-06-12 06:56:51 +0000
commitd0bd3b5af4a796d8f0b83815a3f164ae811c0626 (patch)
tree02ebe7f6eeab523dcf5190845b95a9b91ed1affb /activerecord/test
parent3cb26e9cb3c1f3a069e7654988c650ca12322ede (diff)
downloadrails-d0bd3b5af4a796d8f0b83815a3f164ae811c0626.tar.gz
rails-d0bd3b5af4a796d8f0b83815a3f164ae811c0626.tar.bz2
rails-d0bd3b5af4a796d8f0b83815a3f164ae811c0626.zip
Return PostgreSQL columns in the order they are declared #1374 (perlguy@gmail.com). Unit test column order, adapter housekeeping, simplify users of columns_hash.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1405 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/fixtures/db_definitions/postgresql.sql2
-rw-r--r--activerecord/test/reflection_test.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/test/fixtures/db_definitions/postgresql.sql b/activerecord/test/fixtures/db_definitions/postgresql.sql
index 2fd210cb1b..6eb2304957 100644
--- a/activerecord/test/fixtures/db_definitions/postgresql.sql
+++ b/activerecord/test/fixtures/db_definitions/postgresql.sql
@@ -50,10 +50,10 @@ CREATE TABLE topics (
bonus_time time,
last_read date,
content text,
+ approved smallint DEFAULT 1,
replies_count integer default 0,
parent_id integer,
"type" character varying(50),
- approved smallint DEFAULT 1,
PRIMARY KEY (id)
);
SELECT setval('topics_id_seq', 100);
diff --git a/activerecord/test/reflection_test.rb b/activerecord/test/reflection_test.rb
index a892fb4acb..1658408d7a 100644
--- a/activerecord/test/reflection_test.rb
+++ b/activerecord/test/reflection_test.rb
@@ -22,6 +22,11 @@ class ReflectionTest < Test::Unit::TestCase
assert_equal 12, Topic.columns.length
end
+ def test_columns_are_returned_in_the_order_they_were_declared
+ column_names = Topic.columns.map { |column| column.name }
+ assert_equal %w(id title author_name author_email_address written_on bonus_time last_read content approved replies_count parent_id type), column_names
+ end
+
def test_content_columns
assert_equal 8, Topic.content_columns.length
end