Sha256: d7cf654b529b49f4dc4a2a8768fccc71569451480e9f7c576bd0f5d280fd5591

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'simplecov'
require 'timecop'
require 'tempfile'
require 'codeclimate-test-reporter'
require 'aruba/rspec'

CodeClimate::TestReporter.start

def production_code
  spec = caller[0][/spec.+\.rb/]
  './'+ spec.gsub('_spec','').gsub(/spec/, 'lib')
end

def project_root_file name
  File.join(File.dirname(__FILE__), '..', name)
end

def backup_file_name(name)
  project_root_file(name) + '.orig'
end

def backup_file name
  file = project_root_file(name)
  backup = backup_file_name(name)
  FileUtils.mv file, backup if File.exists?(file)
end

def restore_file name
  file = project_root_file(name)
  backup = backup_file_name(name)
  FileUtils.mv backup, file if File.exists?(backup)
end

def remove_file name
  FileUtils.rm project_root_file(name), force: true
end

SEMVER_FILES = [ '.semver', 'history.rdoc', 'CHANGELOG.md' ]

RSpec.configure do |config|
  config.include ArubaDoubles

  config.before :suite do
    Aruba::RSpec.setup
    SEMVER_FILES.map{|f| backup_file f}
  end

  config.after :suite do
    SEMVER_FILES.map{|f| restore_file f}
    Aruba::RSpec.teardown
  end
end

SimpleCov.start do
  add_filter '/vendor/'
  add_filter '/spec/'
  coverage_dir 'log/coverage/spec'
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake-n-bake-1.4.2 spec/spec_helper.rb
rake-n-bake-1.4.1 spec/spec_helper.rb
rake-n-bake-1.4.0 spec/spec_helper.rb
rake-n-bake-1.3.3 spec/spec_helper.rb