diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
commit | d22130922e7842226d38d59680e4bbb48a28a5f0 (patch) | |
tree | 39594d3a14641dd5488a99a5e633239296fa5742 /test/rubygems/test_gem_specification.rb | |
parent | 4752539e3f3e563d559732c52424206bd6f12dbd (diff) | |
download | ruby-d22130922e7842226d38d59680e4bbb48a28a5f0.tar.gz |
Import rubygems 1.8.5 (released @ 137c80f)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_specification.rb')
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 437 |
1 files changed, 264 insertions, 173 deletions
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index d7f5772259..ef52f0a50e 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -35,8 +35,8 @@ Gem::Specification.new do |s| s.version = %q{0.4.0} s.has_rdoc = true s.summary = %q{A Hash which automatically computes keys.} - s.files = ["lib/keyedlist.rb"] - s.require_paths = ["lib"] + s.files = [%q{lib/keyedlist.rb}] + s.require_paths = [%q{lib}] s.autorequire = %q{keyedlist} s.author = %q{Florian Gross} s.email = %q{flgr@ccan.de} @@ -46,11 +46,9 @@ end def setup super - # TODO: there is no reason why the spec tests need to write to disk - @a1 = quick_gem 'a', '1' do |s| + @a1 = quick_spec 'a', '1' do |s| s.executable = 'exec' s.extensions << 'ext/a/extconf.rb' - s.has_rdoc = 'true' s.test_file = 'test/suite.rb' s.requirements << 'A working computer' s.rubyforge_project = 'example' @@ -64,15 +62,10 @@ end s.files = %w[lib/code.rb] end - @a2 = quick_gem 'a', '2' do |s| + @a2 = quick_spec 'a', '2' do |s| s.files = %w[lib/code.rb] end - FileUtils.mkdir_p File.join(@tempdir, 'bin') - File.open File.join(@tempdir, 'bin', 'exec'), 'w' do |fp| - fp.puts "#!#{Gem.ruby}" - end - @current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION end @@ -83,7 +76,6 @@ end bindir cert_chain date - default_executable dependencies description email @@ -91,7 +83,6 @@ end extensions extra_rdoc_files files - has_rdoc homepage licenses name @@ -129,18 +120,39 @@ end assert_equal @current_version, new_spec.specification_version end + def test_self_from_yaml_syck_bug + # This is equivalent to (and totally valid) psych 1.0 output and + # causes parse errors on syck. + yaml = @a1.to_yaml + yaml.sub!(/^date:.*/, "date: 2011-04-26 00:00:00.000000000Z") + + new_spec = with_syck do + Gem::Specification.from_yaml yaml + end + + assert_kind_of Time, @a1.date + assert_kind_of Time, new_spec.date + end + def test_self_load - spec = File.join @gemhome, 'specifications', @a2.spec_name - gs = Gem::Specification.load spec + full_path = @a2.spec_file + write_file full_path do |io| + io.write @a2.to_ruby_for_cache + end + + spec = Gem::Specification.load full_path + + @a2.files.clear - assert_equal @a2, gs + assert_equal @a2, spec end def test_self_load_legacy_ruby - spec = eval LEGACY_RUBY_SPEC + spec = Deprecate.skip_during do + eval LEGACY_RUBY_SPEC + end assert_equal 'keyedlist', spec.name assert_equal '0.4.0', spec.version.to_s - assert_equal true, spec.has_rdoc? assert_equal Gem::Specification::TODAY, spec.date assert spec.required_ruby_version.satisfied_by?(Gem::Version.new('1')) assert_equal false, spec.has_unit_tests? @@ -195,8 +207,6 @@ end assert_equal [], spec.requirements assert_equal [], spec.dependencies assert_equal 'bin', spec.bindir - assert_equal true, spec.has_rdoc - assert_equal true, spec.has_rdoc? assert_equal '>= 0', spec.required_ruby_version.to_s assert_equal '>= 0', spec.required_rubygems_version.to_s end @@ -279,9 +289,6 @@ end assert_equal 'bin', spec.bindir assert_same spec.bindir, new_spec.bindir - assert_equal true, spec.has_rdoc - assert_same spec.has_rdoc, new_spec.has_rdoc - assert_equal '>= 0', spec.required_ruby_version.to_s assert_same spec.required_ruby_version, new_spec.required_ruby_version @@ -290,6 +297,23 @@ end new_spec.required_rubygems_version end + def test_initialize_copy_broken + spec = Gem::Specification.new do |s| + s.name = 'a' + s.version = '1' + end + + spec.instance_variable_set :@licenses, :blah + spec.loaded_from = '/path/to/file' + + e = assert_raises Gem::FormatException do + spec.dup + end + + assert_equal 'a-1 has an invalid value for @licenses', e.message + assert_equal '/path/to/file', e.file_path + end + def test__dump @a2.platform = Gem::Platform.local @a2.instance_variable_set :@original_platform, 'old_platform' @@ -338,37 +362,33 @@ end def test_date_equals_date @a1.date = Date.new(2003, 9, 17) - assert_equal Time.local(2003, 9, 17, 0,0,0), @a1.date + assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date end def test_date_equals_string @a1.date = '2003-09-17' - assert_equal Time.local(2003, 9, 17, 0,0,0), @a1.date + assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date + end + + def test_date_equals_string_bad + assert_raises Gem::InvalidSpecificationException do + @a1.date = '9/11/2003' + end end def test_date_equals_time @a1.date = Time.local(2003, 9, 17, 0,0,0) - assert_equal Time.local(2003, 9, 17, 0,0,0), @a1.date + assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date end def test_date_equals_time_local - # HACK PDT - @a1.date = Time.local(2003, 9, 17, 19,50,0) - assert_equal Time.local(2003, 9, 17, 0,0,0), @a1.date + @a1.date = Time.local(2003, 9, 17, 19,50,0) # may not pass in utc >= +4 + assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date end def test_date_equals_time_utc - # HACK PDT - @a1.date = Time.local(2003, 9, 17, 19,50,0) - assert_equal Time.local(2003, 9, 17, 0,0,0), @a1.date - end - - def test_default_executable - assert_equal 'exec', @a1.default_executable - - @a1.default_executable = nil - @a1.instance_variable_set :@executables, nil - assert_equal nil, @a1.default_executable + @a1.date = Time.utc(2003, 9, 17, 19,50,0) + assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date end def test_dependencies @@ -391,60 +411,20 @@ end end def test_eql_eh - g1 = quick_spec 'gem' - g2 = quick_spec 'gem' + g1 = new_spec 'gem', 1 + g2 = new_spec 'gem', 1 assert_equal g1, g2 assert_equal g1.hash, g2.hash assert_equal true, g1.eql?(g2) end - def test_equals2 - assert_equal @a1, @a1 - assert_equal @a1, @a1.dup - refute_equal @a1, @a2 - refute_equal @a1, Object.new - end - - # The cgikit specification was reported to be causing trouble in at least - # one version of RubyGems, so we test explicitly for it. - def test_equals2_cgikit - cgikit = Gem::Specification.new do |s| - s.name = %q{cgikit} - s.version = "1.1.0" - s.date = %q{2004-03-13} - s.summary = %q{CGIKit is a componented-oriented web application } + - %q{framework like Apple Computers WebObjects. } + - %{This framework services Model-View-Controller architecture } + - %q{programming by components based on a HTML file, a definition } + - %q{file and a Ruby source. } - s.email = %q{info@spice-of-life.net} - s.homepage = %q{http://www.spice-of-life.net/download/cgikit/} - s.autorequire = %q{cgikit} - s.bindir = nil - s.has_rdoc = true - s.required_ruby_version = nil - s.platform = nil - s.files = ["lib/cgikit", "lib/cgikit.rb", "lib/cgikit/components", "..."] - end - - assert_equal cgikit, cgikit - end - - def test_equals2_default_executable - spec = @a1.dup - spec.default_executable = 'xx' - - refute_equal @a1, spec - refute_equal spec, @a1 - end - - def test_equals2_extensions + def test_eql_eh_extensions spec = @a1.dup spec.extensions = 'xx' - refute_equal @a1, spec - refute_equal spec, @a1 + refute_operator @a1, :eql?, spec + refute_operator spec, :eql?, @a1 end def test_executables @@ -542,9 +522,26 @@ end assert_kind_of Integer, @a1.hash end + def test_for_cache + @a2.add_runtime_dependency 'b', '1' + @a2.dependencies.first.instance_variable_set :@type, nil + @a2.required_rubygems_version = Gem::Requirement.new '> 0' + @a2.test_files = %w[test/test_b.rb] + + refute_empty @a2.files + refute_empty @a2.test_files + + spec = @a2.for_cache + + assert_empty spec.files + assert_empty spec.test_files + + refute_empty @a2.files + refute_empty @a2.test_files + end + def test_full_gem_path - assert_equal File.join(@gemhome, 'gems', @a1.full_name), - @a1.full_gem_path + assert_equal File.join(@gemhome, 'gems', @a1.full_name), @a1.full_gem_path @a1.original_platform = 'mswin32' @@ -553,11 +550,11 @@ end end def test_full_gem_path_double_slash - gemhome = @gemhome.sub(/\w\//, '\&/') - @a1.loaded_from = File.join gemhome, 'specifications', @a1.spec_name + gemhome = @gemhome.to_s.sub(/\w\//, '\&/') + @a1.loaded_from = File.join gemhome, "specifications", @a1.spec_name - assert_equal File.join(@gemhome, 'gems', @a1.full_name), - @a1.full_gem_path + expected = File.join @gemhome, "gems", @a1.full_name + assert_equal expected, @a1.full_gem_path end def test_full_name @@ -589,21 +586,6 @@ end end end - def test_has_rdoc_eh - assert @a1.has_rdoc? - end - - def test_has_rdoc_equals - - use_ui @ui do - @a1.has_rdoc = false - end - - assert_equal '', @ui.output - - assert_equal true, @a1.has_rdoc - end - def test_hash assert_equal @a1.hash, @a1.hash assert_equal @a1.hash, @a1.dup.hash @@ -611,15 +593,14 @@ end end def test_installation_path - assert_equal @gemhome, @a1.installation_path + Deprecate.skip_during do + assert_equal @gemhome, @a1.installation_path - @a1.instance_variable_set :@loaded_from, nil + @a1.instance_variable_set :@loaded_from, nil + @a1.instance_variable_set :@loaded, false - e = assert_raises Gem::Exception do - @a1.installation_path + assert_nil @a1.installation_path end - - assert_equal 'spec a-1 is not from an installed gem', e.message end def test_lib_files @@ -717,8 +698,8 @@ end end def test_spaceship_name - s1 = quick_spec 'a', '1' - s2 = quick_spec 'b', '1' + s1 = new_spec 'a', '1' + s2 = new_spec 'b', '1' assert_equal(-1, (s1 <=> s2)) assert_equal( 0, (s1 <=> s1)) @@ -726,8 +707,8 @@ end end def test_spaceship_platform - s1 = quick_spec 'a', '1' - s2 = quick_spec 'a', '1' do |s| + s1 = new_spec 'a', '1' + s2 = new_spec 'a', '1' do |s| s.platform = Gem::Platform.new 'x86-my_platform1' end @@ -737,8 +718,8 @@ end end def test_spaceship_version - s1 = quick_spec 'a', '1' - s2 = quick_spec 'a', '2' + s1 = new_spec 'a', '1' + s2 = new_spec 'a', '2' assert_equal( -1, (s1 <=> s2)) assert_equal( 0, (s1 <=> s1)) @@ -773,13 +754,13 @@ Gem::Specification.new do |s| s.version = \"2\" s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version= - s.authors = [\"A User\"] + s.authors = [%q{A User}] s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}} s.description = %q{This is a test description} s.email = %q{example@example.com} - s.files = [\"lib/code.rb\"] + s.files = [%q{lib/code.rb}] s.homepage = %q{http://example.com} - s.require_paths = [\"lib\"] + s.require_paths = [%q{lib}] s.rubygems_version = %q{#{Gem::VERSION}} s.summary = %q{this is a summary} @@ -820,12 +801,12 @@ Gem::Specification.new do |s| s.version = \"2\" s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version= - s.authors = [\"A User\"] + s.authors = [%q{A User}] s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}} s.description = %q{This is a test description} s.email = %q{example@example.com} s.homepage = %q{http://example.com} - s.require_paths = [\"lib\"] + s.require_paths = [%q{lib}] s.rubygems_version = %q{#{Gem::VERSION}} s.summary = %q{this is a summary} @@ -868,22 +849,21 @@ Gem::Specification.new do |s| s.platform = Gem::Platform.new(#{expected_platform}) s.required_rubygems_version = Gem::Requirement.new(\">= 0\") if s.respond_to? :required_rubygems_version= - s.authors = [\"A User\"] + s.authors = [%q{A User}] s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}} - s.default_executable = %q{exec} s.description = %q{This is a test description} s.email = %q{example@example.com} - s.executables = [\"exec\"] - s.extensions = [\"ext/a/extconf.rb\"] - s.files = [\"lib/code.rb\", \"test/suite.rb\", \"bin/exec\", \"ext/a/extconf.rb\"] + s.executables = [%q{exec}] + s.extensions = [%q{ext/a/extconf.rb}] + s.files = [%q{lib/code.rb}, %q{test/suite.rb}, %q{bin/exec}, %q{ext/a/extconf.rb}] s.homepage = %q{http://example.com} - s.licenses = [\"MIT\"] - s.require_paths = [\"lib\"] - s.requirements = [\"A working computer\"] + s.licenses = [%q{MIT}] + s.require_paths = [%q{lib}] + s.requirements = [%q{A working computer}] s.rubyforge_project = %q{example} s.rubygems_version = %q{#{Gem::VERSION}} s.summary = %q{this is a summary} - s.test_files = [\"test/suite.rb\"] + s.test_files = [%q{test/suite.rb}] if s.respond_to? :specification_version then s.specification_version = 3 @@ -913,7 +893,9 @@ end end def test_to_ruby_legacy - gemspec1 = eval LEGACY_RUBY_SPEC + gemspec1 = Deprecate.skip_during do + eval LEGACY_RUBY_SPEC + end ruby_code = gemspec1.to_ruby gemspec2 = eval ruby_code @@ -936,7 +918,7 @@ end refute_match '!!null', yaml_str - same_spec = YAML.load(yaml_str) + same_spec = Gem::Specification.from_yaml(yaml_str) assert_equal @a1, same_spec end @@ -945,7 +927,7 @@ end @a1.platform = Gem::Platform.local yaml_str = @a1.to_yaml - same_spec = YAML.load(yaml_str) + same_spec = Gem::Specification.from_yaml(yaml_str) assert_equal Gem::Platform.local, same_spec.platform @@ -984,41 +966,48 @@ end end end + def x s; s.gsub(/xxx/, ''); end + def w; x "WARxxxNING"; end + def t; x "TOxxxDO"; end + def f; x "FxxxIXME"; end + def test_validate_authors util_setup_validate Dir.chdir @tempdir do - @a1.authors = [] + @a1.authors = [""] use_ui @ui do @a1.validate end - assert_equal "WARNING: no author specified\n", @ui.error, 'error' + assert_equal "#{w}: no author specified\n", @ui.error, 'error' @a1.authors = [Object.new] + assert_equal [], @a1.authors + e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal 'authors must be Array of Strings', e.message + assert_equal "authors may not be empty", e.message - @a1.authors = ['FIXME (who is writing this software)'] + @a1.authors = ["#{f} (who is writing this software)"] e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not an author', e.message + assert_equal %{"#{f}" or "#{t}" is not an author}, e.message - @a1.authors = ['TODO (who is writing this software)'] + @a1.authors = ["#{t} (who is writing this software)"] e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not an author', e.message + assert_equal %{"#{f}" or "#{t}" is not an author}, e.message end end @@ -1032,7 +1021,7 @@ end @a1.validate end - assert_equal "WARNING: deprecated autorequire specified\n", + assert_equal "#{w}: deprecated autorequire specified\n", @ui.error, 'error' end end @@ -1047,34 +1036,34 @@ end @a1.validate end - assert_equal "WARNING: no description specified\n", @ui.error, 'error' + assert_equal "#{w}: no description specified\n", @ui.error, "error" @ui = Gem::MockGemUi.new - @a1.summary = 'this is my summary' + @a1.summary = "this is my summary" @a1.description = @a1.summary use_ui @ui do @a1.validate end - assert_equal "WARNING: description and summary are identical\n", - @ui.error, 'error' + assert_equal "#{w}: description and summary are identical\n", + @ui.error, "error" - @a1.description = 'FIXME (describe your package)' + @a1.description = "#{f} (describe your package)" e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not a description', e.message + assert_equal %{"#{f}" or "#{t}" is not a description}, e.message - @a1.description = 'TODO (describe your package)' + @a1.description = "#{t} (describe your package)" e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not a description', e.message + assert_equal %{"#{f}" or "#{t}" is not a description}, e.message end end @@ -1082,35 +1071,33 @@ end util_setup_validate Dir.chdir @tempdir do - @a1.email = '' + @a1.email = "" use_ui @ui do @a1.validate end - assert_equal "WARNING: no email specified\n", @ui.error, 'error' + assert_equal "#{w}: no email specified\n", @ui.error, "error" - @a1.email = 'FIXME (your e-mail)' + @a1.email = "FIxxxXME (your e-mail)".sub(/xxx/, "") e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not an email address', e.message + assert_equal %{"#{f}" or "#{t}" is not an email}, e.message - @a1.email = 'TODO (your e-mail)' + @a1.email = "#{t} (your e-mail)" e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not an email address', e.message + assert_equal %{"#{f}" or "#{t}" is not an email}, e.message end end def test_validate_empty - util_setup_validate - e = assert_raises Gem::InvalidSpecificationException do Gem::Specification.new.validate end @@ -1134,7 +1121,7 @@ end assert_equal %w[exec], @a1.executables assert_equal '', @ui.output, 'output' - assert_equal "WARNING: bin/exec is missing #! line\n", @ui.error, 'error' + assert_equal "#{w}: bin/exec is missing #! line\n", @ui.error, 'error' end def test_validate_empty_require_paths @@ -1183,7 +1170,7 @@ end @a1.validate end - assert_equal "WARNING: no homepage specified\n", @ui.error, 'error' + assert_equal "#{w}: no homepage specified\n", @ui.error, 'error' @ui = Gem::MockGemUi.new @@ -1193,7 +1180,7 @@ end @a1.validate end - assert_equal "WARNING: no homepage specified\n", @ui.error, 'error' + assert_equal "#{w}: no homepage specified\n", @ui.error, 'error' @a1.homepage = 'over at my cool site' @@ -1216,6 +1203,26 @@ end assert_equal 'invalid value for attribute name: ":json"', e.message end + def test_validate_non_nil + util_setup_validate + + Dir.chdir @tempdir do + assert @a1.validate + + Gem::Specification.non_nil_attributes.each do |name| + next if name == :files # set by #normalize + spec = @a1.dup + spec.instance_variable_set "@#{name}", nil + + e = assert_raises Gem::InvalidSpecificationException do + spec.validate + end + + assert_match %r%^#{name}%, e.message + end + end + end + def test_validate_platform_legacy util_setup_validate @@ -1270,23 +1277,23 @@ end @a1.validate end - assert_equal "WARNING: no summary specified\n", @ui.error, 'error' + assert_equal "#{w}: no summary specified\n", @ui.error, 'error' - @a1.summary = 'FIXME (describe your package)' + @a1.summary = "#{f} (describe your package)" e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not a summary', e.message + assert_equal %{"#{f}" or "#{t}" is not a summary}, e.message - @a1.summary = 'TODO (describe your package)' + @a1.summary = "#{t} (describe your package)" e = assert_raises Gem::InvalidSpecificationException do @a1.validate end - assert_equal '"FIXME" or "TODO" is not a summary', e.message + assert_equal %{"#{f}" or "#{t}" is not a summary}, e.message end end @@ -1310,6 +1317,67 @@ end specfile.delete end + ## + # KEEP p-1-x86-darwin-8 + # KEEP p-1 + # KEEP c-1.2 + # KEEP a_evil-9 + # a-1 + # a-1-x86-my_platform-1 + # KEEP a-2 + # a-2-x86-other_platform-1 + # KEEP a-2-x86-my_platform-1 + # a-3.a + # KEEP a-3-x86-other_platform-1 + + def test_latest_specs + util_clear_gems + util_setup_fake_fetcher + + quick_spec 'p', '1' + + p1_curr = quick_spec 'p', '1' do |spec| + spec.platform = Gem::Platform::CURRENT + end + + quick_spec @a1.name, @a1.version do |s| + s.platform = Gem::Platform.new 'x86-my_platform1' + end + + quick_spec @a1.name, @a1.version do |s| + s.platform = Gem::Platform.new 'x86-third_platform1' + end + + quick_spec @a2.name, @a2.version do |s| + s.platform = Gem::Platform.new 'x86-my_platform1' + end + + quick_spec @a2.name, @a2.version do |s| + s.platform = Gem::Platform.new 'x86-other_platform1' + end + + quick_spec @a2.name, @a2.version.bump do |s| + s.platform = Gem::Platform.new 'x86-other_platform1' + end + + Gem::Specification.remove_spec @b2 + Gem::Specification.remove_spec @pl1 + + expected = %W[ + a-2 + a-2-x86-my_platform-1 + a-3-x86-other_platform-1 + a_evil-9 + c-1.2 + p-1 + #{p1_curr.full_name} + ] + + latest_specs = Gem::Specification.latest_specs.map(&:full_name).sort + + assert_equal expected, latest_specs + end + def util_setup_deps @gem = quick_spec "awesome", "1.0" do |awesome| awesome.add_runtime_dependency "bonobo", [] @@ -1322,13 +1390,36 @@ end def util_setup_validate Dir.chdir @tempdir do - FileUtils.mkdir_p File.join('ext', 'a') - FileUtils.mkdir_p 'lib' - FileUtils.mkdir_p 'test' + FileUtils.mkdir_p File.join("ext", "a") + FileUtils.mkdir_p "lib" + FileUtils.mkdir_p "test" + FileUtils.mkdir_p "bin" + + FileUtils.touch File.join("ext", "a", "extconf.rb") + FileUtils.touch File.join("lib", "code.rb") + FileUtils.touch File.join("test", "suite.rb") - FileUtils.touch File.join('ext', 'a', 'extconf.rb') - FileUtils.touch File.join('lib', 'code.rb') - FileUtils.touch File.join('test', 'suite.rb') + File.open "bin/exec", "w" do |fp| + fp.puts "#!#{Gem.ruby}" + end + end + end + + def with_syck + begin + require "yaml" + old_engine = YAML::ENGINE.yamler + YAML::ENGINE.yamler = 'syck' + rescue NameError + # probably on 1.8, ignore + end + + yield + ensure + begin + YAML::ENGINE.yamler = old_engine + rescue NameError + # ignore end end end |