Sha256: f4cf04d5a7f156c903f99e3885b33a918a2adac60b30b69be3c24d9f23fccab3

Contents?: true

Size: 931 Bytes

Versions: 8

Compression:

Stored size: 931 Bytes

Contents

require 'spec_helper'

describe "be_a_migration" do

  let(:migration_files) { ['db/migrate/20110504132601_create_posts.rb', 'db/migrate/20110520132601_create_users.rb'] }

  before do
    migration_files.each do |migration_file|
      allow(File).to receive(:exist?).with(migration_file).and_return(true)
    end
  end
  it 'should find for the migration file adding the filename timestamp for us' do
    expect(Dir).to receive(:glob).with('db/migrate/[0-9]*_*.rb').and_return(migration_files)
    expect('db/migrate/create_users.rb').to be_a_migration
  end
  it 'should find for the migration file when we know the filename timestamp' do
    expect('db/migrate/20110504132601_create_posts.rb').to be_a_migration
  end
  it 'should know when a migration does not exist' do
    expect(Dir).to receive(:glob).with('db/migrate/[0-9]*_*.rb').and_return([])
    expect('db/migrate/create_comments.rb').to_not be_a_migration
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ammeter-1.1.7 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-1.1.6 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-1.1.5 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-1.1.4 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-1.1.3 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-1.1.2 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-1.1.1 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-1.1.0 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb