Sha256: cc653c3a34e9091c9cbdf1240939c7326c4ca43e33ba75d63ded2dec9f2d70f1
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
# This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration ENV['thor_env'] = 'test' ENV['waka_log'] = 'false' require 'codeclimate-test-reporter' CodeClimate::TestReporter.start require 'webmock/rspec' WebMock.disable_net_connect!(allow: 'codeclimate.com') require 'gitwakatime' RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus config.order = 'random' config.before(:all) do @wdir = set_file_paths GitWakaTime.config.setup_local_db GitWakaTime::Commit.new.columns GitWakaTime::CommitedFile.new.columns GitWakaTime::Heartbeat.new.columns end config.around(:each) do |example| DB.transaction(rollback: :always, auto_savepoint: true) { example.run } end config.before(:each) do allow( GitWakaTime.config ).to receive('user_name').and_return('Russell Osborne') end config.after(:all) do FileUtils.rm_r(File.dirname(@wdir)) end end def set_file_paths @test_dir = File.join(File.dirname(__FILE__)) @wdir_dot = File.expand_path(File.join(@test_dir, 'dummy')) @wdir = create_temp_repo(@wdir_dot) end def create_temp_repo(clone_path) filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s.rjust(3, '0') @tmp_path = File.expand_path( File.join(File.dirname(__FILE__), '..', 'tmp', filename) ) FileUtils.mkdir_p(@tmp_path) FileUtils.cp_r(clone_path, @tmp_path) tmp_path = File.join(@tmp_path, 'dummy') activate_repo_as_git(tmp_path) tmp_path end def activate_repo_as_git(path) Dir.chdir(path) do FileUtils.mv('dot_git', '.git') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gitwakatime-0.4.0 | spec/spec_helper.rb |