diff options
author | Andre Arko <andre@arko.net> | 2015-04-09 00:05:43 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-04-09 00:06:34 -0700 |
commit | a72df72c7719bcb7677e5cb140cf7cdb11be652d (patch) | |
tree | 72f32cd6aa77c2609d806db3707ecc04f02d90dd | |
parent | c57e3ffbf403b6896df81f99845905c763fc41b5 (diff) | |
download | bundler-a72df72c7719bcb7677e5cb140cf7cdb11be652d.tar.gz |
always remove the push guard on RG < 2.0
-rw-r--r-- | spec/bundler/gem_helper_spec.rb | 13 | ||||
-rw-r--r-- | spec/commands/newgem_spec.rb | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index 2b0f3d97aa..2a7e230d63 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -28,6 +28,15 @@ describe Bundler::GemHelper do end context "interpolates the name" do + before do + # Remove exception that prevents public pushes on older RubyGems versions + if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0") + content = File.read(app_gemspec_path) + content.sub!(/raise "RubyGems 2\.0 or newer.*/, "") + File.open(app_gemspec_path, "w"){|f| f.write(content) } + end + end + it "when there is only one gemspec" do expect(subject.gemspec.name).to eq(app_name) end @@ -67,6 +76,10 @@ describe Bundler::GemHelper do before(:each) do content = app_gemspec_content.gsub("TODO: ", "") content.sub!(/homepage\s+= ".*"/, 'homepage = ""') + # Remove exception that prevents public pushes on older RubyGems versions + if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0") + content.sub!(/raise "RubyGems 2\.0 or newer.*/, "") + end File.open(app_gemspec_path, "w") { |file| file << content } end diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 286f00ca51..57c88c53b5 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -7,6 +7,15 @@ describe "bundle gem" do global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false" end + def remove_push_guard(gem_name) + # Remove exception that prevents public pushes on older RubyGems versions + if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0") + path = "#{gem_name}/#{gem_name}.gemspec" + content = File.read(path).sub(/raise "RubyGems 2\.0 or newer.*/, "") + File.open(path, "w"){|f| f.write(content) } + end + end + before do @git_name = `git config --global user.name`.chomp `git config --global user.name "Bundler User"` @@ -57,6 +66,9 @@ describe "bundle gem" do line.gsub(/\=.*$/, "= %q{A short summary of my new gem.}") when /spec\.description/ line.gsub(/\=.*$/, "= %q{A longer description of my new gem.}") + # Remove exception that prevents public pushes on older RubyGems versions + when /raise "RubyGems 2.0 or newer/ + line.gsub(/.*/, '') if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0") else line end @@ -112,6 +124,7 @@ describe "bundle gem" do before do bundle "gem #{gem_name}" + remove_push_guard(gem_name) # reset gemspec cache for each test because of commit 3d4163a Bundler.clear_gemspec_cache end @@ -150,6 +163,7 @@ describe "bundle gem" do reset! in_app_root bundle "gem #{gem_name}" + remove_push_guard(gem_name) end it_should_behave_like "git config is absent" @@ -323,6 +337,7 @@ describe "bundle gem" do before do bundle "gem #{gem_name} --mit" + remove_push_guard(gem_name) # reset gemspec cache for each test because of commit 3d4163a Bundler.clear_gemspec_cache end @@ -364,6 +379,7 @@ describe "bundle gem" do before do bundle "gem #{gem_name}" + remove_push_guard(gem_name) # reset gemspec cache for each test because of commit 3d4163a Bundler.clear_gemspec_cache end @@ -397,6 +413,7 @@ describe "bundle gem" do reset! in_app_root bundle "gem #{gem_name}" + remove_push_guard(gem_name) end it_should_behave_like "git config is absent" |