Sha256: 2598fb5db80f887a0acd6c4c4a55a5afdbcde49420f6cfd078568e28a7ed9238
Contents?: true
Size: 978 Bytes
Versions: 8
Compression:
Stored size: 978 Bytes
Contents
require 'spec_helper' require 'rake' describe 'octopus.rake' do before do load File.expand_path('../../../lib/tasks/octopus.rake', __FILE__) Rake::Task.define_task(:environment) end describe 'octopus:copy_schema_versions' do class SchemaMigration < ActiveRecord::Base; end before do Rake::Task['octopus:copy_schema_versions'].reenable path = File.expand_path('../../migrations', __FILE__) ActiveRecord::Migrator.migrations_paths = [path] end it 'assumes each shard migrated to the current master version' do SchemaMigration.create(:version => 1) SchemaMigration.create(:version => 2) SchemaMigration.create(:version => 3) Rake::Task['octopus:copy_schema_versions'].invoke ActiveRecord::Base.connection.shard_names.each do |shard_name| expect(Octopus.using(shard_name) { ActiveRecord::SchemaMigration.all.pluck(:version).map(&:to_i).sort }).to eq([1, 2, 3]) end end end end
Version data entries
8 entries across 8 versions & 3 rubygems