diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-16 04:05:15 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-16 04:05:15 +0000 |
commit | cd2b092f0c5baa0b3d766055842c031188e50c9f (patch) | |
tree | ca2fae98c554b2a20cbf5978c8b04e049cbd2550 /activerecord | |
parent | 7117fdb8ceeb4d8cc18651a74ea52f1bed2b077c (diff) | |
download | rails-cd2b092f0c5baa0b3d766055842c031188e50c9f.tar.gz rails-cd2b092f0c5baa0b3d766055842c031188e50c9f.tar.bz2 rails-cd2b092f0c5baa0b3d766055842c031188e50c9f.zip |
r3957@asus: jeremy | 2005-10-16 00:01:55 -0700
more sequence tests from #2292
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2640 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/adapter_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/test/adapter_test.rb b/activerecord/test/adapter_test.rb index 4496da8585..7d427cda50 100644 --- a/activerecord/test/adapter_test.rb +++ b/activerecord/test/adapter_test.rb @@ -35,4 +35,24 @@ class AdapterTest < Test::Unit::TestCase ensure @connection.remove_index :accounts, :firm_id rescue nil end + + # test resetting sequences in odd tables in postgreSQL + if ActiveRecord::Base.connection.respond_to?(:reset_pk_sequence!) + require 'fixtures/movie' + require 'fixtures/subscriber' + def test_reset_empty_table_with_custom_pk + Movie.delete_all + Movie.connection.reset_pk_sequence! 'movies' + assert_equal 1, Movie.create(:name => 'fight club').id + end + + def test_reset_table_with_non_integer_pk + Subscriber.delete_all + Subscriber.connection.reset_pk_sequence! 'subscribers' + + sub = Subscriber.new(:name => 'robert drake') + sub.id = 'bob drake' + assert sub.save! + end + end end |