From 5d438215365e1a5dc3da7172a511a335aa58a5b4 Mon Sep 17 00:00:00 2001 From: hsbt Date: Tue, 24 Jan 2017 02:38:57 +0000 Subject: Update Rubygems 2.6.10 * https://github.com/rubygems/rubygems/commit/2ee5bf9fd3bd7649d3e244bc40107ff32070ef47 * https://github.com/rubygems/rubygems/commit/be510dd4097e65c6a256a6e173d6b724a3a96472 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rubygems/test_gem_stub_specification.rb | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'test/rubygems/test_gem_stub_specification.rb') diff --git a/test/rubygems/test_gem_stub_specification.rb b/test/rubygems/test_gem_stub_specification.rb index 4cba13e139..5316449fba 100644 --- a/test/rubygems/test_gem_stub_specification.rb +++ b/test/rubygems/test_gem_stub_specification.rb @@ -33,6 +33,20 @@ class TestStubSpecification < Gem::TestCase assert_equal %w[ext/stub_e/extconf.rb], stub.extensions end + def test_initialize_version + stub = stub_with_version + + assert_equal 'stub_v', stub.name + assert_equal v(2), stub.version + end + + def test_initialize_with_empty_version + stub = stub_without_version + + assert_equal 'stub_v', stub.name + assert_equal v(0), stub.version + end + def test_initialize_missing_stubline stub = Gem::StubSpecification.gemspec_stub(BAR, @base_dir, @gems_dir) assert_equal "bar", stub.name @@ -164,6 +178,53 @@ class TestStubSpecification < Gem::TestCase assert stub.to_spec.instance_variable_get :@ignored end + def stub_with_version + spec = File.join @gemhome, 'specifications', 'stub_e-2.gemspec' + open spec, 'w' do |io| + io.write <<-STUB +# -*- encoding: utf-8 -*- +# stub: stub_v 2 ruby lib + +Gem::Specification.new do |s| + s.name = 'stub_v' + s.version = Gem::Version.new '2' +end + STUB + + io.flush + + stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems') + + yield stub if block_given? + + return stub + end + end + + def stub_without_version + spec = File.join @gemhome, 'specifications', 'stub-2.gemspec' + open spec, 'w' do |io| + io.write <<-STUB +# -*- encoding: utf-8 -*- +# stub: stub_v ruby lib + +Gem::Specification.new do |s| + s.name = 'stub_v' + s.version = "" +end + STUB + + io.flush + + stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems') + + yield stub if block_given? + + return stub + end + + end + def stub_with_extension spec = File.join @gemhome, 'specifications', 'stub_e-2.gemspec' open spec, 'w' do |io| -- cgit v1.2.3