Skip to content

Commit b055f44

Browse files
committed
Change position of test cases
1 parent 7b0ba36 commit b055f44

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

spec/lib/annotate/annotate_models_spec.rb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,27 @@ def mock_column(name, type, options = {})
453453
expect(AnnotateModels.get_schema_info(klass, 'Schema Info', show_indexes: true)).to eql(expected_result)
454454
end
455455

456+
it 'should not crash getting indexes keys' do
457+
klass = mock_class(:users,
458+
:id,
459+
[
460+
mock_column(:id, :integer),
461+
mock_column(:foreign_thing_id, :integer)
462+
], [])
463+
464+
expected_result = <<~EOS
465+
# Schema Info
466+
#
467+
# Table name: users
468+
#
469+
# id :integer not null, primary key
470+
# foreign_thing_id :integer not null
471+
#
472+
EOS
473+
474+
expect(AnnotateModels.get_schema_info(klass, 'Schema Info', show_indexes: true)).to eql(expected_result)
475+
end
476+
456477
it 'should get simple indexes keys' do
457478
klass = mock_class(:users,
458479
:id,
@@ -502,27 +523,6 @@ def mock_column(name, type, options = {})
502523
expect(AnnotateModels.get_schema_info(klass, 'Schema Info', simple_indexes: true)).to eql(expected_result)
503524
end
504525

505-
it 'should not crash getting indexes keys' do
506-
klass = mock_class(:users,
507-
:id,
508-
[
509-
mock_column(:id, :integer),
510-
mock_column(:foreign_thing_id, :integer)
511-
], [])
512-
513-
expected_result = <<~EOS
514-
# Schema Info
515-
#
516-
# Table name: users
517-
#
518-
# id :integer not null, primary key
519-
# foreign_thing_id :integer not null
520-
#
521-
EOS
522-
523-
expect(AnnotateModels.get_schema_info(klass, 'Schema Info', show_indexes: true)).to eql(expected_result)
524-
end
525-
526526
it 'should get foreign key info' do
527527
klass = mock_class(:users,
528528
:id,

0 commit comments

Comments
 (0)