Sha256: 83fac16dae81d36b627eebfb03332c40132b07eb76a375da1d8d32250f742d1f

Contents?: true

Size: 951 Bytes

Versions: 6

Compression:

Stored size: 951 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::Migrator.get_all_versions }).to eq([1, 2, 3])
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ar-octopus-0.8.6 spec/tasks/octopus.rake_spec.rb
misha-ar-octopus-0.8.7 spec/tasks/octopus.rake_spec.rb
misha-ar-octopus-0.8.5 spec/tasks/octopus.rake_spec.rb
ar-octopus-0.8.5 spec/tasks/octopus.rake_spec.rb
ar-octopus-0.8.4 spec/tasks/octopus.rake_spec.rb
ar-octopus-0.8.3 spec/tasks/octopus.rake_spec.rb