0
@@ -8,20 +8,33 @@ class TestCreateTable < Test::Unit::TestCase
0
@adapter.stubs(:supports_foreign_keys?).returns(true)
0
- # should "create a foreign key on table.references" do
0
- # @adapter.expects(:execute).with(
0
- # 'CREATE TABLE users (' +
0
- # 'id primary_key, ' +
0
- # 'department_id integer NOT NULL, ' +
0
- # 'CONSTRAINT fk_users_department_id_departments_id ' +
0
- # 'FOREIGN KEY (department_id) REFERENCES departments(id)) '
0
- # @adapter.create_table :users do |t|
0
- # t.references :departments, :null => false
0
+ should "create a foreign key on table.references" do
0
+ @adapter.expects(:execute).with(
0
+ 'CREATE TABLE users (' +
0
+ 'department_id integer NOT NULL, ' +
0
+ 'CONSTRAINT fk_users_department_id_departments_id ' +
0
+ 'FOREIGN KEY (department_id) REFERENCES departments(id)) '
0
+ @adapter.create_table :users do |t|
0
+ t.references :department, :null => false
0
+ should "create a foreign key on table.belongs_to" do
0
+ @adapter.expects(:execute).with(
0
+ 'CREATE TABLE users (' +
0
+ 'department_id integer NOT NULL, ' +
0
+ 'CONSTRAINT fk_users_department_id_departments_id ' +
0
+ 'FOREIGN KEY (department_id) REFERENCES departments(id)) '
0
+ @adapter.create_table :users do |t|
0
+ t.belongs_to :department, :null => false
0
should "allow simple foreign key definitions" do
0
@adapter.expects(:execute).with(
0
@@ -37,7 +50,7 @@ class TestCreateTable < Test::Unit::TestCase
0
- should "allow
_action_options" do
0
+ should "allow
action options" do
0
@adapter.expects(:execute).with(
0
'CREATE TABLE users (' +
0
@@ -51,7 +64,7 @@ class TestCreateTable < Test::Unit::TestCase
0
- should "allow
_multiple_action_options" do
0
+ should "allow
multiple action options" do
0
@adapter.expects(:execute).with(
0
'CREATE TABLE users (' +
0
@@ -65,7 +78,7 @@ class TestCreateTable < Test::Unit::TestCase
0
- should "allow
_complex_foreign_key_definitions" do
0
+ should "allow
complex foreign key definitions" do
0
@adapter.expects(:execute).with(
0
'CREATE TABLE users (' +
0
@@ -79,7 +92,7 @@ class TestCreateTable < Test::Unit::TestCase
0
- should "allow
_constraint_syntax" do
0
+ should "allow
constraint syntax" do
0
@adapter.expects(:execute).with(
0
'CREATE TABLE users (' +
0
@@ -94,7 +107,7 @@ class TestCreateTable < Test::Unit::TestCase
0
- should "allow
_complex_constraint_syntax" do
0
+ should "allow
complex constraint syntax" do
0
@adapter.expects(:execute).with(
0
'CREATE TABLE users (' +
Comments
No one has commented yet.