mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Rails 5.2 upgrade and global gem upgrade
This updates tests to use latest rails 5 practice and updates ALL dependencies that could be updated Performance testing shows that performance has not regressed if anything it is marginally faster now.
This commit is contained in:
@@ -21,6 +21,11 @@ describe Migration::SafeMigrate do
|
||||
$stdout = old_stdout
|
||||
end
|
||||
|
||||
def migrate_up(path)
|
||||
migrations = ActiveRecord::MigrationContext.new(path).migrations
|
||||
ActiveRecord::Migrator.new(:up, migrations, migrations.first.version).run
|
||||
end
|
||||
|
||||
it "bans all table removal" do
|
||||
Migration::SafeMigrate.enable!
|
||||
|
||||
@@ -28,7 +33,7 @@ describe Migration::SafeMigrate do
|
||||
|
||||
output = capture_stdout do
|
||||
expect(lambda do
|
||||
ActiveRecord::Migrator.up([path])
|
||||
migrate_up(path)
|
||||
end).to raise_error(StandardError)
|
||||
end
|
||||
|
||||
@@ -45,14 +50,14 @@ describe Migration::SafeMigrate do
|
||||
|
||||
output = capture_stdout do
|
||||
expect(lambda do
|
||||
ActiveRecord::Migrator.up([path])
|
||||
migrate_up(path)
|
||||
end).to raise_error(StandardError)
|
||||
end
|
||||
|
||||
expect(output).to include("TableDropper")
|
||||
|
||||
expect { User.first }.not_to raise_error
|
||||
expect(User.first).not_to eq(nil)
|
||||
|
||||
expect(output).to include("TableDropper")
|
||||
end
|
||||
|
||||
it "bans all column removal" do
|
||||
@@ -62,7 +67,7 @@ describe Migration::SafeMigrate do
|
||||
|
||||
output = capture_stdout do
|
||||
expect(lambda do
|
||||
ActiveRecord::Migrator.up([path])
|
||||
migrate_up(path)
|
||||
end).to raise_error(StandardError)
|
||||
end
|
||||
|
||||
@@ -79,7 +84,7 @@ describe Migration::SafeMigrate do
|
||||
|
||||
output = capture_stdout do
|
||||
expect(lambda do
|
||||
ActiveRecord::Migrator.up([path])
|
||||
migrate_up(path)
|
||||
end).to raise_error(StandardError)
|
||||
end
|
||||
|
||||
@@ -96,7 +101,7 @@ describe Migration::SafeMigrate do
|
||||
path = File.expand_path "#{Rails.root}/spec/fixtures/migrate/drop_table"
|
||||
|
||||
output = capture_stdout do
|
||||
ActiveRecord::Migrator.up([path])
|
||||
migrate_up(path)
|
||||
end
|
||||
|
||||
expect(output).to include("drop_table(:users)")
|
||||
|
||||
Reference in New Issue
Block a user