Sha256: 09f109b49a6a0313df805c3d953dff3cb82d3e08d9b2e53a2e717b573435a299
Contents?: true
Size: 932 Bytes
Versions: 6
Compression:
Stored size: 932 Bytes
Contents
module RSpec::Rails module Migration include RSpec::Rails::App::Dirs 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
6 entries across 6 versions & 1 rubygems