Sha256: a12dd77a76040fca1ad5874e73b4a09e0b037d1619b5306a61653c9239b8df61
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'simplecov' SimpleCov.start require 'rspec' require 'bundler/plumber/version' require 'bundler/plumber/database' module Helpers def sh(command, options={}) Bundler.with_clean_env do result = `#{command} 2>&1` raise "FAILED #{command}\n#{result}" if $?.success? == !!options[:fail] result end end def decolorize(string) string.gsub(/\e\[\d+m/, "") end def mocked_user_path File.expand_path('../../tmp/ruby-mem-advisory-db', __FILE__) end def expect_update_to_clone_repo! expect(Bundler::Plumber::Database). to receive(:system). with('git', 'clone', Bundler::Plumber::Database::VENDORED_PATH, mocked_user_path). and_call_original end def expect_update_to_update_repo! expect(Bundler::Plumber::Database). to receive(:system). with("git fetch --all; git reset --hard origin/master"). and_call_original end def fake_a_commit_in_the_user_repo Dir.chdir(mocked_user_path) do system 'git', 'commit', '--allow-empty', '-m', 'Dummy commit.' end end def roll_user_repo_back(num_commits) Dir.chdir(mocked_user_path) do system 'git', 'reset', '--hard', "HEAD~#{num_commits}" end end end include Bundler::Plumber RSpec.configure do |config| include Helpers config.before(:each) do stub_const("Bundler::Plumber::Database::URL", Bundler::Plumber::Database::VENDORED_PATH) stub_const("Bundler::Plumber::Database::USER_PATH", mocked_user_path) FileUtils.rm_rf(mocked_user_path) if File.exist?(mocked_user_path) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bundler-leak-0.1.1 | spec/spec_helper.rb |