Project

General

Profile

Bug #13842 ยป rubygems-2613-ruby22-testcase.patch

hsbt (Hiroshi SHIBATA), 09/10/2017 01:01 AM

View differences:

test/rubygems/test_gem_installer.rb
1215 1215
  end
1216 1216

  
1217 1217
  def test_pre_install_checks_malicious_name
1218
    spec = util_spec '../malicious', '1'
1218
    spec = Gem::Specification.new do |s|
1219
      s.platform    = Gem::Platform::RUBY
1220
      s.name        = '../malicious'
1221
      s.version     = '1'
1222
      s.author      = 'A User'
1223
      s.email       = 'example@example.com'
1224
      s.homepage    = 'http://example.com'
1225
      s.summary     = "this is a summary"
1226
      s.description = "This is a test description"
1227
    end
1228

  
1229
    Gem::Specification.reset
1230

  
1219 1231
    def spec.full_name # so the spec is buildable
1220 1232
      "malicious-1"
1221 1233
    end
......
1226 1238
    gem = File.join(@gemhome, 'cache', spec.file_name)
1227 1239

  
1228 1240
    use_ui @ui do
1229
      @installer = Gem::Installer.at gem
1241
      @installer = Gem::Installer.new gem
1230 1242
      e = assert_raises Gem::InstallError do
1231 1243
        @installer.pre_install_checks
1232 1244
      end