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