discourse/spec/components/freedom_patches/schema_migration_details_spec.rb
Sam Saffron 4ea21fa2d0 DEV: use #frozen_string_literal: true on all spec
This change both speeds up specs (less strings to allocate) and helps catch
cases where methods in Discourse are mutating inputs.

Overall we will be migrating everything to use #frozen_string_literal: true
it will take a while, but this is the first and safest move in this direction
2019-04-30 10:27:42 +10:00

34 lines
938 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
require_dependency "freedom_patches/schema_migration_details"
describe FreedomPatches::SchemaMigrationDetails do
# we usually don't really need this model so lets not clutter up with it
class SchemaMigrationDetail < ActiveRecord::Base
end
class TestMigration < ActiveRecord::Migration[4.2]
def up
sleep 0.001
end
end
it "logs information on migration" do
migration = TestMigration.new("awesome_migration", "20160225050318")
ActiveRecord::Base.connection_pool.with_connection do |conn|
migration.exec_migration(conn, :up)
end
info = SchemaMigrationDetail.find_by(version: "20160225050318")
expect(info.duration).to be > 0
expect(info.git_version).to eq Discourse.git_version
expect(info.direction).to eq "up"
expect(info.rails_version).to eq Rails.version
expect(info.name).to eq "awesome_migration"
end
end