mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 05:55:46 +02:00

Otherwise we get
```
✗ rake TEST=test/rubygems/test_project_sanity.rb
Loaded suite /Users/deivid/.gem/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_test_loader
Started
E
============================================================================================================================================================================================================
Error: test_manifest_is_up_to_date(TestProjectSanity):
RuntimeError: There was an error running `rake check_manifest`: /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems.rb:263:in `find_spec_for_exe': can't find gem rake (>= 0.a) with executable rake (Gem::GemNotFoundException)
from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems.rb:282:in `activate_bin_path'
from /Users/deivid/.asdf/installs/ruby/3.2.1/bin/rake:25:in `<main>'
/Users/deivid/Code/rubygems/rubygems/test/rubygems/test_project_sanity.rb:27:in `test_manifest_is_up_to_date'
24:
25: raise "Expected Manifest.txt to be up to date, but it's not. Run `rake update_manifest` to sync it."
26: else
=> 27: raise "There was an error running `rake check_manifest`: #{out}"
28: end
29: end
30: end
============================================================================================================================================================================================================
.
Finished in 0.188192 seconds.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2 tests, 1 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
50% passed
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
10.63 tests/s, 5.31 assertions/s
rake aborted!
```
29829933a6
49 lines
1.2 KiB
Ruby
49 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "helper"
|
|
require "open3"
|
|
|
|
class TestProjectSanity < Gem::TestCase
|
|
def setup
|
|
end
|
|
|
|
def teardown
|
|
end
|
|
|
|
def test_manifest_is_up_to_date
|
|
pend unless File.exist?("#{root}/Rakefile")
|
|
|
|
_, status = Open3.capture2e("rake check_manifest")
|
|
|
|
unless status.success?
|
|
original_contents = File.read("#{root}/Manifest.txt")
|
|
|
|
# Update the manifest to see if it fixes the problem
|
|
Open3.capture2e("rake update_manifest")
|
|
|
|
out, status = Open3.capture2e("rake check_manifest")
|
|
|
|
# If `rake update_manifest` fixed the problem, that was the original
|
|
# issue, otherwise it was an unknown error, so print the error output
|
|
if status.success?
|
|
File.write("#{root}/Manifest.txt", original_contents)
|
|
|
|
raise "Expected Manifest.txt to be up to date, but it's not. Run `rake update_manifest` to sync it."
|
|
else
|
|
raise "There was an error running `rake check_manifest`: #{out}"
|
|
end
|
|
end
|
|
end
|
|
|
|
def test_require_rubygems_package
|
|
err, status = Open3.capture2e(*ruby_with_rubygems_in_load_path, "--disable-gems", "-e", "require \"rubygems/package\"")
|
|
|
|
assert status.success?, err
|
|
end
|
|
|
|
private
|
|
|
|
def root
|
|
File.expand_path("../..", __dir__)
|
|
end
|
|
end
|