From 2db8514d218068cae7b37b7939ed3ba812407105 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 25 Apr 2016 07:54:56 +0900 Subject: Treat blank comments as no comment for indexes Follow up of 1683410. Signed-off-by: Jeremy Daer --- activerecord/test/cases/comment_test.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/comment_test.rb b/activerecord/test/cases/comment_test.rb index 37d951ad88..839fdbe578 100644 --- a/activerecord/test/cases/comment_test.rb +++ b/activerecord/test/cases/comment_test.rb @@ -5,7 +5,6 @@ if ActiveRecord::Base.connection.supports_comments? class CommentTest < ActiveRecord::TestCase include SchemaDumpingHelper - self.use_transactional_tests = false if current_adapter?(:Mysql2Adapter) class Commented < ActiveRecord::Base self.table_name = 'commenteds' @@ -29,6 +28,10 @@ class CommentTest < ActiveRecord::TestCase t.string :empty_comment, comment: '' t.string :nil_comment, comment: nil t.string :absent_comment + t.index :space_comment, comment: ' ' + t.index :empty_comment, comment: '' + t.index :nil_comment, comment: nil + t.index :absent_comment end Commented.reset_column_information @@ -54,6 +57,12 @@ class CommentTest < ActiveRecord::TestCase end end + def test_blank_indexes_created_in_block + @connection.indexes('blank_comments').each do |index| + assert_nil index.comment + end + end + def test_add_column_with_comment_later @connection.add_column :commenteds, :rating, :integer, comment: 'I am running out of imagination' Commented.reset_column_information -- cgit v1.2.3