spec/spec_helper.rb in overapp-0.3.1 vs spec/spec_helper.rb in overapp-0.4.0

- old
+ new

@@ -1,9 +1,30 @@ require 'rubygems' require 'spork' +require 'mharris_ext' +class SpecGitDir + include FromHash + attr_accessor :dir + def setup! + `cp -r #{dir}/git_dir #{dir}/.git` unless FileTest.exist?("#{dir}/.git") + end + + def teardown! + `rm -rf #{dir}/.git` if FileTest.exist?("#{dir}/.git") + end + + class << self + def make(name) + dir = File.dirname(__FILE__) + "/input/#{name}" + new(:dir => dir) + end + end +end + + Spork.prefork do unless ENV['DRB'] require 'simplecov' SimpleCov.start end @@ -17,10 +38,24 @@ # in ./support/ and its subdirectories. Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} RSpec.configure do |config| #config.filter_run :focus => true - config.fail_fast = false + config.fail_fast = true + + repo_dirs = %w(repo) + + config.before(:all) do + repo_dirs.each do |dir| + SpecGitDir.make(dir).setup! + end + end + + config.after(:all) do + repo_dirs.each do |dir| + SpecGitDir.make(dir).teardown! + end + end end end Spork.each_run do if ENV['DRB']