summaryrefslogtreecommitdiff
path: root/test/rubygems/test_project_sanity.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-11-11 15:03:57 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-11-11 16:59:49 +0900
commit7d463e360b9c4718b17378eb52783116a01b884b (patch)
treeee6951d298d76fcbf0c5e062712e54de56a3fa39 /test/rubygems/test_project_sanity.rb
parent31416423809f64d4b5ea6b9651cced3179cc5ced (diff)
Merge RubyGems 3.1.0.pre3
* Fix gem pristine not accounting for user installed gems. Pull request #2914 by Luis Sagastume. * Refactor keyword argument test for Ruby 2.7. Pull request #2947 by SHIBATA Hiroshi. * Fix errors at frozen Gem::Version. Pull request #2949 by Nobuyoshi Nakada. * Remove taint usage on Ruby 2.7+. Pull request #2951 by Jeremy Evans. * Check Manifest.txt is up to date. Pull request #2953 by David Rodríguez. * Clarify symlink conditionals in tests. Pull request #2962 by David Rodríguez. * Update command line parsing to work under ps. Pull request #2966 by David Rodríguez. * Properly test `Gem::Specifications.stub_for`. Pull request #2970 by David Rodríguez. * Fix Gem::LOADED_SPECS_MUTEX handling for recursive locking. Pull request #2985 by MSP-Greg.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2666
Diffstat (limited to 'test/rubygems/test_project_sanity.rb')
-rw-r--r--test/rubygems/test_project_sanity.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/rubygems/test_project_sanity.rb b/test/rubygems/test_project_sanity.rb
new file mode 100644
index 0000000000..72f5e3b36e
--- /dev/null
+++ b/test/rubygems/test_project_sanity.rb
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+require "rubygems/test_case"
+require "open3"
+
+class TestProjectSanity < Minitest::Test
+
+ def test_rake_package_builds_ok
+ skip unless File.exist?(File.expand_path("../../../Rakefile", __FILE__))
+
+ with_empty_pkg_folder do
+ output, status = Open3.capture2e("rake package")
+
+ assert_equal true, status.success?, <<~MSG.chomp
+ Expected `rake package` to work, but got errors:
+
+ ```
+ #{output}
+ ```
+
+ If you have added or removed files, make sure you run `rake update_manifest` to update the `Manifest.txt` accordingly
+ MSG
+ end
+ end
+
+ def test_manifest_is_up_to_date
+ skip unless File.exist?(File.expand_path("../../../Rakefile", __FILE__))
+
+ _, status = Open3.capture2e("rake check_manifest")
+
+ assert status.success?, "Expected Manifest.txt to be up to date, but it's not. Run `rake update_manifest` to sync it."
+ end
+
+ private
+
+ def with_empty_pkg_folder
+ if File.exist?("pkg")
+ FileUtils.cp_r("pkg", "tmp")
+
+ begin
+ FileUtils.rm_rf("pkg")
+ yield
+ ensure
+ FileUtils.rm_rf("pkg")
+ FileUtils.cp_r("tmp/pkg", ".")
+ end
+ else
+ Dir.mkdir("pkg")
+
+ begin
+ yield
+ ensure
+ FileUtils.rm_rf("pkg")
+ end
+ end
+ end
+
+end