Sha256: 021986e3d31a6a08d2f126b9755bdd3df881908643c11c3e6a6b77bbd6e81135
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require 'rspec' require 'bundler/audit/version' 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-advisory-db', __FILE__) end def expect_update_to_clone_repo! Bundler::Audit::Database. should_receive(:system). with('git', 'clone', Bundler::Audit::Database::VENDORED_PATH, mocked_user_path). and_call_original end def expect_update_to_update_repo! Bundler::Audit::Database. should_receive(:system). with('git', 'pull', '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::Audit RSpec.configure do |config| include Helpers config.before(:each) do stub_const("Bundler::Audit::Database::URL", Bundler::Audit::Database::VENDORED_PATH) stub_const("Bundler::Audit::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-audit-0.3.1 | spec/spec_helper.rb |