diff options
author | Andre Arko <andre@arko.net> | 2015-01-26 20:53:46 -0800 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-03-30 17:06:34 +0100 |
commit | 62430f9aabdcb68bc05759918bfbc476066c70b4 (patch) | |
tree | a0de0bd3bf76c9d9adc76b277fa960af126a8aa3 | |
parent | 19a134152cdd99f6623e452731ba8e73699c01e4 (diff) | |
download | bundler-62430f9aabdcb68bc05759918bfbc476066c70b4.tar.gz |
set global config before creating gems
fixes hanging specs on 1.8.7 on Travis, I hope
-rw-r--r-- | spec/bundler/gem_helper_spec.rb | 1 | ||||
-rw-r--r-- | spec/commands/newgem_spec.rb | 5 | ||||
-rw-r--r-- | spec/support/helpers.rb | 22 |
3 files changed, 18 insertions, 10 deletions
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index a1698fc585..d3df2dc768 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -8,6 +8,7 @@ describe Bundler::GemHelper do let(:app_gemspec_path) { app_path.join("#{app_name}.gemspec") } before(:each) do + global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false" bundle "gem #{app_name}" end diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index fc0e782e6a..024ca0cabb 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -1,6 +1,11 @@ require "spec_helper" describe "bundle gem" do + def reset! + super + global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false" + end + before do @git_name = `git config --global user.name`.chomp `git config --global user.name "Bundler User"` diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index db1a785ea2..7eb2ebd979 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -153,8 +153,7 @@ module Spec @exitstatus = $?.exitstatus end - def config(config = nil) - path = bundled_app('.bundle/config') + def config(config = nil, path = bundled_app('.bundle/config')) return YAML.load_file(path) unless config FileUtils.mkdir_p(File.dirname(path)) File.open(path, 'w') do |f| @@ -163,20 +162,23 @@ module Spec config end + def global_config(config = nil) + config(config, home(".bundle/config")) + end + def gemfile(*args) - path = bundled_app("Gemfile") - path = args.shift if args.first.is_a?(Pathname) - str = args.shift || "" - path.dirname.mkpath - File.open(path.to_s, 'w') do |f| - f.puts strip_whitespace(str) - end + create_file("Gemfile", *args) end def lockfile(*args) - path = bundled_app("Gemfile.lock") + create_file("Gemfile.lock", *args) + end + + def create_file(*args) + path = bundled_app(args.shift) path = args.shift if args.first.is_a?(Pathname) str = args.shift || "" + path.dirname.mkpath File.open(path.to_s, 'w') do |f| f.puts strip_whitespace(str) end |