summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-18 05:11:55 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-18 05:11:55 +0000
commitf20ad4889d5c7af44581373d25fd326ce796c4b3 (patch)
treeb7bf99329ed8c29768f2502d3bd418e57be32268 /test/rubygems/test_gem_installer.rb
parent513345607da396f33b862dc2a48135e8a14bad99 (diff)
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems
HEAD(2c6d256). It contains to update vendored Molinillo to 0.5.0. https://github.com/rubygems/rubygems/pull/1638 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index dedb4c99ca..b8bf24e183 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1106,6 +1106,77 @@ gem 'other', version
assert_path_exists expected_makefile
end
+ def test_install_extension_dir_is_removed_on_reinstall
+ @spec.extensions << "extconf.rb"
+ write_file File.join(@tempdir, "extconf.rb") do |io|
+ io.write <<-RUBY
+ require "mkmf"
+ create_makefile("#{@spec.name}")
+ RUBY
+ end
+
+ @spec.files += %w[extconf.rb]
+
+ path = Gem::Package.build @spec
+
+ # Install a gem with an extension
+ use_ui @ui do
+ installer = Gem::Installer.at path
+ installer.install
+ end
+
+ # pretend that a binary file was created as part of the build
+ should_be_removed = File.join(@spec.extension_dir, "#{@spec.name}.so")
+ write_file should_be_removed do |io|
+ io.write "DELETE ME ON REINSTALL"
+ end
+ assert_path_exists should_be_removed
+
+ # reinstall the gem, this is also the same as pristine
+ use_ui @ui do
+ installer = Gem::Installer.at path
+ installer.install
+ end
+
+ refute_path_exists should_be_removed
+ end
+
+ def test_find_lib_file_after_install
+ @spec.extensions << "extconf.rb"
+ write_file File.join(@tempdir, "extconf.rb") do |io|
+ io.write <<-RUBY
+ require "mkmf"
+ create_makefile("#{@spec.name}")
+ RUBY
+ end
+
+ write_file File.join(@tempdir, "a.c") do |io|
+ io.write <<-C
+ #include <ruby.h>
+ void Init_a() { }
+ C
+ end
+
+ Dir.mkdir File.join(@tempdir, "lib")
+ write_file File.join(@tempdir, 'lib', "b.rb") do |io|
+ io.write "# b.rb"
+ end
+
+ @spec.files += %w[extconf.rb lib/b.rb a.c]
+
+ use_ui @ui do
+ path = Gem::Package.build @spec
+
+ installer = Gem::Installer.at path
+ installer.install
+ end
+
+ expected = File.join @spec.full_require_paths.find { |path|
+ File.exist? File.join path, 'b.rb'
+ }, 'b.rb'
+ assert_equal expected, @spec.matches_for_glob('b.rb').first
+ end
+
def test_install_extension_and_script
@spec.extensions << "extconf.rb"
write_file File.join(@tempdir, "extconf.rb") do |io|