Permalink
Browse files

primary key behavioral tests

  • Loading branch information...
tenderlove committed Jul 10, 2010
1 parent 51783c0 commit 0bac4c7e0287faa81461c94e6f3a38041b4181ee
Showing with 17 additions and 0 deletions.
  1. +17 −0 activerecord/test/cases/adapters/sqlite/sqlite_adapter_test.rb
@@ -170,6 +170,23 @@ def test_compound_index
assert_equal %w{ id number }.sort, index.columns.sort
end
+ def test_primary_key
+ assert_equal 'id', @ctx.primary_key('items')
+
+ @ctx.execute <<-eosql
+ CREATE TABLE foos (
+ internet integer PRIMARY KEY AUTOINCREMENT,
+ number integer not null
+ )
+ eosql
+ assert_equal 'internet', @ctx.primary_key('foos')
+ end
+
+ def test_no_primary_key
+ @ctx.execute 'CREATE TABLE failboat (number integer not null)'
+ assert_nil @ctx.primary_key('failboat')
+ end
+
private
def assert_logged logs

0 comments on commit 0bac4c7

Please sign in to comment.