@@ -1140,6 +1140,41 @@ def mock_column(name, type, options = {})
1140
1140
end
1141
1141
end
1142
1142
1143
+ context 'when both table and columns have comments' do
1144
+ let :table_comment do
1145
+ 'users table comment'
1146
+ end
1147
+
1148
+ let :columns do
1149
+ [
1150
+ mock_column ( :id , :integer , limit : 8 , comment : 'ID' ) ,
1151
+ mock_column ( :active , :boolean , limit : 1 , comment : 'Active' ) ,
1152
+ mock_column ( :name , :string , limit : 50 , comment : 'Name' ) ,
1153
+ mock_column ( :notes , :text , limit : 55 , comment : 'Notes' ) ,
1154
+ mock_column ( :no_comment , :text , limit : 20 , comment : nil )
1155
+ ]
1156
+ end
1157
+
1158
+ let :expected_result do
1159
+ <<~EOS
1160
+ # Schema Info
1161
+ #
1162
+ # Table name: users(users table comment)
1163
+ #
1164
+ # id(ID) :integer not null, primary key
1165
+ # active(Active) :boolean not null
1166
+ # name(Name) :string(50) not null
1167
+ # notes(Notes) :text(55) not null
1168
+ # no_comment :text(20) not null
1169
+ #
1170
+ EOS
1171
+ end
1172
+
1173
+ it 'works with option "with_comment' do
1174
+ is_expected . to eq expected_result
1175
+ end
1176
+ end
1177
+
1143
1178
context 'when columns have multibyte comments' do
1144
1179
let :columns do
1145
1180
[
0 commit comments