Sha256: 7d9c3b033920b072265dddfd370ef78122bd0f722d7e63026b6130fa75ddfd34
Contents?: true
Size: 926 Bytes
Versions: 4
Compression:
Stored size: 926 Bytes
Contents
module RSpec::Rails module Migration include RSpec::Rails::App def create_migration number, name, &block file = migration_file_name(number, name) unless File.exist?(file) FileUtils.mkdir_p File.dirname(file) File.open(file, 'w') do |f| f.puts file_content(name) yield f if block_given? end end end def remove_migration name migrations = Dir.glob("#{migration_dir}/[0-9]*_*.rb") migration_file = if !migrations.empty? migrations.grep(/\d+_#{name}\.rb$/).first else false end FileUtils.rm_f(migration_file) if migration_file end def remove_migrations *names names.each do |name| remove_migration name end end def migration_file_name number, name File.join(migration_dir, "#{number}_#{name}.rb") end end end
Version data entries
4 entries across 4 versions & 1 rubygems