Skip to content

Commit 5464b75

Browse files
committed
Move test cases when "format_doc" and "with_comment" are specified in options
1 parent ecb2a0b commit 5464b75

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

spec/lib/annotate/annotate_models_spec.rb

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,39 @@ def mock_column(name, type, options = {})
15051505
end
15061506
end
15071507
end
1508+
1509+
context 'when "format_doc" and "with_comment" are specified in options' do
1510+
let :options do
1511+
{ format_rdoc: true, with_comment: true }
1512+
end
1513+
1514+
context 'when columns are normal' do
1515+
let :columns do
1516+
[
1517+
mock_column(:id, :integer, comment: 'ID'),
1518+
mock_column(:name, :string, limit: 50, comment: 'Name')
1519+
]
1520+
end
1521+
1522+
let :expected_result do
1523+
<<~EOS
1524+
# == Schema Information
1525+
#
1526+
# Table name: users
1527+
#
1528+
# *id(ID)*:: <tt>integer, not null, primary key</tt>
1529+
# *name(Name)*:: <tt>string(50), not null</tt>
1530+
#--
1531+
# == Schema Information End
1532+
#++
1533+
EOS
1534+
end
1535+
1536+
it 'returns schema info in RDoc format' do
1537+
is_expected.to eq expected_result
1538+
end
1539+
end
1540+
end
15081541
end
15091542
end
15101543
end
@@ -1614,39 +1647,6 @@ def mock_column(name, type, options = {})
16141647
AnnotateModels::PREFIX
16151648
end
16161649

1617-
context 'when "format_doc" and "with_comment" are specified in options' do
1618-
let :options do
1619-
{ format_rdoc: true, with_comment: true }
1620-
end
1621-
1622-
context 'when columns are normal' do
1623-
let :columns do
1624-
[
1625-
mock_column(:id, :integer, comment: 'ID'),
1626-
mock_column(:name, :string, limit: 50, comment: 'Name')
1627-
]
1628-
end
1629-
1630-
let :expected_result do
1631-
<<~EOS
1632-
# == Schema Information
1633-
#
1634-
# Table name: users
1635-
#
1636-
# *id(ID)*:: <tt>integer, not null, primary key</tt>
1637-
# *name(Name)*:: <tt>string(50), not null</tt>
1638-
#--
1639-
# == Schema Information End
1640-
#++
1641-
EOS
1642-
end
1643-
1644-
it 'returns schema info in RDoc format' do
1645-
is_expected.to eq expected_result
1646-
end
1647-
end
1648-
end
1649-
16501650
context 'when "format_markdown" and "with_comment" are specified in options' do
16511651
let :options do
16521652
{ format_markdown: true, with_comment: true }

0 commit comments

Comments
 (0)