aboutsummaryrefslogtreecommitdiffstats
path: root/guides/bug_report_templates
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-06-22 08:08:45 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-06-22 08:08:45 +0900
commit2dafc4be2285bc2cb32983be6f16296319b40e25 (patch)
tree50b9c14b9e1bf260c2e3250760611ff328684c25 /guides/bug_report_templates
parenta9bb9d7abc59d497d443d463544d5d859d08463b (diff)
downloadrails-2dafc4be2285bc2cb32983be6f16296319b40e25.tar.gz
rails-2dafc4be2285bc2cb32983be6f16296319b40e25.tar.bz2
rails-2dafc4be2285bc2cb32983be6f16296319b40e25.zip
Do not use private API in bug report templates
`ActiveRecord::Migrator` is private API. https://github.com/rails/rails/blob/bb9d6eb094f29bb94ef1f26aa44f145f17b973fe/activerecord/lib/active_record/migration.rb#L977 Therefore, it is not good to use it in bug report templates. Instead, should use the public API `ActiveRecord::Migration#migrate`.
Diffstat (limited to 'guides/bug_report_templates')
-rw-r--r--guides/bug_report_templates/active_record_migrations_gem.rb6
-rw-r--r--guides/bug_report_templates/active_record_migrations_master.rb6
2 files changed, 4 insertions, 8 deletions
diff --git a/guides/bug_report_templates/active_record_migrations_gem.rb b/guides/bug_report_templates/active_record_migrations_gem.rb
index 0c398e334a..00ba3c1cd6 100644
--- a/guides/bug_report_templates/active_record_migrations_gem.rb
+++ b/guides/bug_report_templates/active_record_migrations_gem.rb
@@ -48,16 +48,14 @@ end
class BugTest < Minitest::Test
def test_migration_up
- migrator = ActiveRecord::Migrator.new(:up, [ChangeAmountToAddScale])
- migrator.run
+ ChangeAmountToAddScale.migrate(:up)
Payment.reset_column_information
assert_equal "decimal(10,2)", Payment.columns.last.sql_type
end
def test_migration_down
- migrator = ActiveRecord::Migrator.new(:down, [ChangeAmountToAddScale])
- migrator.run
+ ChangeAmountToAddScale.migrate(:down)
Payment.reset_column_information
assert_equal "decimal(10,0)", Payment.columns.last.sql_type
diff --git a/guides/bug_report_templates/active_record_migrations_master.rb b/guides/bug_report_templates/active_record_migrations_master.rb
index 84a4b71909..52c9028b0f 100644
--- a/guides/bug_report_templates/active_record_migrations_master.rb
+++ b/guides/bug_report_templates/active_record_migrations_master.rb
@@ -48,16 +48,14 @@ end
class BugTest < Minitest::Test
def test_migration_up
- migrator = ActiveRecord::Migrator.new(:up, [ChangeAmountToAddScale])
- migrator.run
+ ChangeAmountToAddScale.migrate(:up)
Payment.reset_column_information
assert_equal "decimal(10,2)", Payment.columns.last.sql_type
end
def test_migration_down
- migrator = ActiveRecord::Migrator.new(:down, [ChangeAmountToAddScale])
- migrator.run
+ ChangeAmountToAddScale.migrate(:down)
Payment.reset_column_information
assert_equal "decimal(10,0)", Payment.columns.last.sql_type