Sha256: 27ec2fed8df769cdbac805ca2ae68dacc26928e728235198b0819c89460c8a4c

Contents?: true

Size: 854 Bytes

Versions: 6

Compression:

Stored size: 854 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
    File.stub(:exist?).and_return(false)
    migration_files.each do |migration_file|
      File.stub(:exist?).with(migration_file).and_return(true)
    end
    Dir.stub!(:glob).with('db/migrate/[0-9]*_*.rb').and_return(migration_files)
  end
  it 'should find for the migration file adding the filename timestamp for us' do
    'db/migrate/create_users.rb'.should be_a_migration
  end
  it 'should find for the migration file when we know the filename timestamp' do
    'db/migrate/20110504132601_create_posts.rb'.should be_a_migration
  end
  it 'should know when a migration does not exist' do
    'db/migrate/create_comments.rb'.should_not be_a_migration
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ammeter-0.2.9 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-0.2.8 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-0.2.7 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-0.2.6 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-0.2.5 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb
ammeter-0.2.4 spec/ammeter/rspec/generator/matchers/be_a_migration_spec.rb