summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_stub_specification.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-24 02:38:57 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-24 02:38:57 +0000
commit5d438215365e1a5dc3da7172a511a335aa58a5b4 (patch)
tree72ac80942856be3a5370dea6458f3b6dfce671e4 /test/rubygems/test_gem_stub_specification.rb
parent6219b68fb53a77a221f615d47dde83fea0a7e7c8 (diff)
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
Diffstat (limited to 'test/rubygems/test_gem_stub_specification.rb')
-rw-r--r--test/rubygems/test_gem_stub_specification.rb61
1 files changed, 61 insertions, 0 deletions
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|