Sha256: f0d4e669774f47ecf84c415663d6f66f853432ddad277d1e45df5a845bd2fbbc

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require_relative '../../../../lib/mince_migrator/migrations/runner_validator'

describe MinceMigrator::Migrations::RunnerValidator do
  subject { described_class.new(migration) }

  before do
    Mince::Config.interface = mock
  end

  context 'when the migration exists' do
    let(:migration) { mock }

    context 'when it has already ran' do
      before do
        migration.stub(ran?: true)
        subject.call
      end

      its(:call) { should be_false }
      its(:errors) { should == ['Migration has already ran'] }
    end
  end

  context 'when the migration does not exist' do
    let(:migration) { nil }

    before do
      subject.call
    end

    its(:call) { should be_false }
    its(:errors) { should == ['Migration does not exist'] }
  end

  context 'when the mince interface is not set' do
    let(:migration) { mock }

    before do
      Mince::Config.interface = nil
      subject.call
    end

    its(:call) { should be_false }
    its(:errors) { should == ['Mince interface is not set'] }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mince_migrator-1.0.2 spec/units/mince_migrator/migrations/runner_validator_spec.rb
mince_migrator-1.0.1 spec/units/mince_migrator/migrations/runner_validator_spec.rb
mince_migrator-1.0.0 spec/units/mince_migrator/migrations/runner_validator_spec.rb