Sha256: 7f25693042819061917a404be482ec149378ced1eff64d09546a2337cf395c71

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe 'database migrations', type: :aruba do
  context 'after a migration was generated' do
    before { write_file('config/database.yml',
      File.read(File.expand_path('fixtures/database_without_username_and_password.yml', __dir__))) }

    before { run_command_and_stop('bundle exec rails g migration CreateModels name:string') }

    describe 'bundle exec rake db:migrate' do
      let(:action) { run_command('bundle exec rake db:migrate') }
      let(:last_command) { action && last_command_started }

      specify { expect(last_command).to be_successfully_executed }
      specify { expect(last_command).to have_output(/CreateModels: migrated/) }
    end
  end


  describe 'rerun bundle exec rake db:drop db:create db:migrate', issue: 56 do
    let(:command) { 'bundle exec rake db:drop db:create db:migrate' }
    before do
      copy(
        '../../spec/aruba/fixtures/database_without_username_and_password.yml',
        'config/database.yml'
      )
      copy(
        '../../spec/aruba/fixtures/migrations/56/',
        'db/migrate'
      )
    end

    let(:action) { run_command(command) }
    let(:regex) { /-- change_table\(:impressions, {:temporal=>true, :copy_data=>true}\)/ }

    describe 'once' do
      let(:last_command) { action && last_command_started }
      specify { expect(last_command).to be_successfully_executed }
      specify { expect(last_command).to have_output(regex) }
    end

    describe 'twice' do
      let(:last_command) { run_command_and_stop(command) && action && last_command_started }
      specify { expect(last_command).to be_successfully_executed }
      specify { expect(last_command).to have_output(regex) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chrono_model-1.2.2 spec/aruba/migrations_spec.rb
chrono_model-1.2.1 spec/aruba/migrations_spec.rb
chrono_model-1.2.0 spec/aruba/migrations_spec.rb
chrono_model-1.1.0 spec/aruba/migrations_spec.rb
chrono_model-1.0.1 spec/aruba/migrations_spec.rb
chrono_model-1.0.0 spec/aruba/migrations_spec.rb