Sha256: ff00471d7b3fca71398218e71fe1c2389f79587a27f49c6fe1c2d93af88e71b4

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

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

require 'simplecov'
SimpleCov.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.exist?(file)
end

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

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

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

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

12 entries across 12 versions & 1 rubygems

Version Path
rake-n-bake-3.1.2 spec/spec_helper.rb
rake-n-bake-3.1.1 spec/spec_helper.rb
rake-n-bake-3.1.0 spec/spec_helper.rb
rake-n-bake-3.0.0 spec/spec_helper.rb
rake-n-bake-2.1.4 spec/spec_helper.rb
rake-n-bake-2.1.3 spec/spec_helper.rb
rake-n-bake-2.1.2 spec/spec_helper.rb
rake-n-bake-2.1.1 spec/spec_helper.rb
rake-n-bake-2.1.0 spec/spec_helper.rb
rake-n-bake-2.0.1 spec/spec_helper.rb
rake-n-bake-2.0.0 spec/spec_helper.rb
rake-n-bake-1.4.3 spec/spec_helper.rb