Sha256: 93c91a020e52e0939dfd966cffcec3e5308fb5c73913e382c9c74b33effbac04
Contents?: true
Size: 950 Bytes
Versions: 13
Compression:
Stored size: 950 Bytes
Contents
require 'spec_helper' describe ROM::SQL::Migration::Migrator do subject(:migrator) { ROM::SQL::Migration::Migrator.new(conn, options) } let(:conn) { Sequel.connect(DB_URI) } let(:options) { { path: TMP_PATH.join('test/migrations') } } describe '#create_file' do it 'creates a migration file under configured path with specified version and name' do file_path = migrator.create_file('create_users', 1) expect(file_path).to eql(migrator.path.join('1_create_users.rb')) expect(File.exist?(file_path)).to be(true) expect(File.read(file_path)).to eql(migrator.migration_file_content) end it 'auto-generates version when it is not provided' do file_path = migrator.create_file('create_users') expect(file_path.to_s).to match(/.(\d+)_create_users\.rb/) expect(File.exist?(file_path)).to be(true) expect(File.read(file_path)).to eql(migrator.migration_file_content) end end end
Version data entries
13 entries across 13 versions & 1 rubygems