Sha256: a20b0c594993a4cfdaac1ac7015740895884654176c2f73f18167805aa18e669
Contents?: true
Size: 705 Bytes
Versions: 13
Compression:
Stored size: 705 Bytes
Contents
module Cadenero module GeneratorMacros def cleanup! Dir.chdir(Rails.root) do FileUtils.rm_rf("db/migrate") end backup_or_restore = "#{example.metadata[:run] ? "restore" : "backup"}_file" ["#{Rails.root}/app/controllers/application_controller.rb", "#{Rails.root}/config/routes.rb"].each do |file| send(backup_or_restore, file) end end def backup_file(file) FileUtils.cp(file, file + ".bak") end def restore_file(file) FileUtils.mv(file + ".bak", file) end end end RSpec.configure do |c| c.include Cadenero::GeneratorMacros, :example_group => { :file_path => c.escaped_path(%w[spec (generators)]) } end
Version data entries
13 entries across 13 versions & 1 rubygems