2011-01-29 02:46:47 +03:00
|
|
|
require 'rubygems/test_case'
|
2011-03-07 11:44:45 +03:00
|
|
|
require "rubygems/simple_gem"
|
2007-11-10 10:48:56 +03:00
|
|
|
require 'rubygems/validator'
|
|
|
|
|
2011-01-29 02:46:47 +03:00
|
|
|
class TestGemValidator < Gem::TestCase
|
2007-11-10 10:48:56 +03:00
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
|
|
|
|
@simple_gem = SIMPLE_GEM
|
|
|
|
@validator = Gem::Validator.new
|
|
|
|
end
|
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
def test_alien
|
|
|
|
@spec = quick_gem 'a' do |s|
|
|
|
|
s.files = %w[lib/a.rb lib/b.rb]
|
2007-11-10 10:48:56 +03:00
|
|
|
end
|
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
util_build_gem @spec
|
2007-11-10 10:48:56 +03:00
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
FileUtils.rm File.join(@spec.gem_dir, 'lib/b.rb')
|
|
|
|
FileUtils.touch File.join(@spec.gem_dir, 'lib/c.rb')
|
2007-11-10 10:48:56 +03:00
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
alien = @validator.alien 'a'
|
2007-11-10 10:48:56 +03:00
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
expected = {
|
|
|
|
@spec.file_name => [
|
|
|
|
Gem::Validator::ErrorData.new('lib/b.rb', 'Missing file'),
|
|
|
|
Gem::Validator::ErrorData.new('lib/c.rb', 'Extra file'),
|
|
|
|
]
|
|
|
|
}
|
2007-11-10 10:48:56 +03:00
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
assert_equal expected, alien
|
2007-11-10 10:48:56 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|