Skip to content

Commit aaab884

Browse files
committed
Merge pull request #137 from AMekss/fix_composite_primary_keys_test
Fix composite primary keys test
2 parents f1af392 + 8f958f4 commit aaab884

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spec/annotate/annotate_models_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def mock_class(table_name, primary_key, columns)
88
options = {
99
:connection => mock("Conn", :indexes => []),
1010
:table_name => table_name,
11-
:primary_key => primary_key && primary_key.to_s,
11+
:primary_key => primary_key,
1212
:column_names => columns.map { |col| col.name.to_s },
1313
:columns => columns
1414
}
@@ -72,7 +72,7 @@ def mock_column(name, type, options={})
7272
end
7373

7474
it "should get schema info even if the primary key is array, if using composite_primary_keys" do
75-
klass = mock_class(:users, nil, [
75+
klass = mock_class(:users, [:a_id, :b_id], [
7676
mock_column(:a_id, :integer),
7777
mock_column(:b_id, :integer),
7878
mock_column(:name, :string, :limit => 50)
@@ -83,8 +83,8 @@ def mock_column(name, type, options={})
8383
#
8484
# Table name: users
8585
#
86-
# a_id :integer not null
87-
# b_id :integer not null
86+
# a_id :integer not null, primary key
87+
# b_id :integer not null, primary key
8888
# name :string(50) not null
8989
#
9090
EOS

0 commit comments

Comments
 (0)