2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-06-04 18:57:49 +00:00
|
|
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe 'Migration sanity' do
|
|
|
|
it 'Migrations have a sane timestamp' do
|
|
|
|
Dir.open(File.join(Rails.root, 'db', 'migrate')) do |dir|
|
2019-07-30 21:29:24 +00:00
|
|
|
# should be a hash but we don't have in Ruby 2.3
|
2018-06-04 18:57:49 +00:00
|
|
|
migration_names = []
|
|
|
|
|
|
|
|
dir.entries.each do |file|
|
2019-07-30 21:29:24 +00:00
|
|
|
next unless file != '.' && file != '..'
|
2018-06-04 18:57:49 +00:00
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
ret = file.split('_', 2)
|
|
|
|
expect(ret[0].length).to eq 14
|
|
|
|
expect { Integer(ret[0]) }.to_not raise_error
|
|
|
|
expect(migration_names).to_not include ret[1]
|
2018-06-04 18:57:49 +00:00
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
migration_names.push(ret[1])
|
|
|
|
end
|
2018-06-04 18:57:49 +00:00
|
|
|
end
|
|
|
|
end
|
2019-07-30 21:29:24 +00:00
|
|
|
end
|