aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-06-10 13:28:38 +0200
committerYves Senn <yves.senn@gmail.com>2014-06-26 22:03:48 +0200
commit69c711f38cac85e9c8bdbe286591bf88ef720bfa (patch)
tree8d9b10a585c7ba3d2c0c5fa73e38167f388b20e8 /activerecord/test/cases/migration
parenta48b675d54101b048228d1011ffa426c2b7fe94d (diff)
downloadrails-69c711f38cac85e9c8bdbe286591bf88ef720bfa.tar.gz
rails-69c711f38cac85e9c8bdbe286591bf88ef720bfa.tar.bz2
rails-69c711f38cac85e9c8bdbe286591bf88ef720bfa.zip
fk: dump foreign keys to schema.rb
respect `table_name_prefix` and `table_name_suffix`.
Diffstat (limited to 'activerecord/test/cases/migration')
-rw-r--r--activerecord/test/cases/migration/foreign_key_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/foreign_key_test.rb b/activerecord/test/cases/migration/foreign_key_test.rb
index 2b99ab6ecd..f299762b42 100644
--- a/activerecord/test/cases/migration/foreign_key_test.rb
+++ b/activerecord/test/cases/migration/foreign_key_test.rb
@@ -1,11 +1,13 @@
require 'cases/helper'
require 'support/ddl_helper'
+require 'support/schema_dumping_helper'
if ActiveRecord::Base.connection.supports_foreign_keys?
module ActiveRecord
class Migration
class ForeignKeyTest < ActiveRecord::TestCase
include DdlHelper
+ include SchemaDumpingHelper
class Rocket < ActiveRecord::Base
end
@@ -90,6 +92,11 @@ module ActiveRecord
@connection.remove_foreign_key :astronauts, name: "fancy_named_fk"
assert_equal [], @connection.foreign_keys("astronauts")
end
+
+ def test_schema_dumping
+ output = dump_table_schema "fk_test_has_fk"
+ assert_match %r{\s+add_foreign_key "fk_test_has_fk", "fk_test_has_pk", column: "fk_id", primary_key: "id", name: "fk_name"$}, output
+ end
end
end
end