aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/schema_dumper_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-10-08 09:15:37 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-10-10 11:53:22 +0900
commit5025fd3a99c68f95bdd6fd43f382c62e9653236b (patch)
tree4dfbc554f4a66855b112aa971a904d2352a90c30 /activerecord/test/cases/schema_dumper_test.rb
parent02989ee38f8cc5e82e7106ff8689d4635b016f40 (diff)
downloadrails-5025fd3a99c68f95bdd6fd43f382c62e9653236b.tar.gz
rails-5025fd3a99c68f95bdd6fd43f382c62e9653236b.tar.bz2
rails-5025fd3a99c68f95bdd6fd43f382c62e9653236b.zip
Dump index options to pretty format
```ruby # Before t.index ["firm_id", "type", "rating"], name: "company_index", order: {"rating"=>:desc}, using: :btree # After t.index ["firm_id", "type", "rating"], name: "company_index", order: { rating: :desc }, using: :btree ```
Diffstat (limited to 'activerecord/test/cases/schema_dumper_test.rb')
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index 8b604ba930..7f9a5798dd 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -183,8 +183,10 @@ class SchemaDumperTest < ActiveRecord::TestCase
def test_schema_dumps_index_columns_in_right_order
index_definition = standard_dump.split(/\n/).grep(/t\.index.*company_index/).first.strip
- if current_adapter?(:Mysql2Adapter, :PostgreSQLAdapter)
- assert_equal 't.index ["firm_id", "type", "rating"], name: "company_index", using: :btree', index_definition
+ if current_adapter?(:PostgreSQLAdapter)
+ assert_equal 't.index ["firm_id", "type", "rating"], name: "company_index", order: { rating: :desc }, using: :btree', index_definition
+ elsif current_adapter?(:Mysql2Adapter)
+ assert_equal 't.index ["firm_id", "type", "rating"], name: "company_index", length: { type: 10 }, using: :btree', index_definition
else
assert_equal 't.index ["firm_id", "type", "rating"], name: "company_index"', index_definition
end