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