aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorEric Mueller <nevinera@gmail.com>2023-12-01 23:20:27 -0500
committergit <svn-admin@ruby-lang.org>2023-12-06 20:05:25 +0000
commit6fd3b358ff1e1745036286be7007cd0d6ebdcdd7 (patch)
treef5bf3431a8533c203fc67b5fa1811c02ae233bf2 /spec
parenta6c912a80de27a5022528802305e1e97fe5b2678 (diff)
downloadruby-6fd3b358ff1e1745036286be7007cd0d6ebdcdd7.tar.gz
[rubygems/rubygems] Duplicate Gem::CIDetector into bundler
Because bundler needs to support older versions of rubygems, we can't actually rely on Gem::CIDetector (yet - in a year or so they might be able to consolidate, if they don't change futher). So we're copying it into the Bundler:: namespace, and enforcing that they stay completely in sync with a test. No other tests are needed, since Gem::CIDetector is already tested, and this is and will remain identical. https://github.com/rubygems/rubygems/commit/abc67f0da1
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler/ci_detector_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/bundler/bundler/ci_detector_spec.rb b/spec/bundler/bundler/ci_detector_spec.rb
new file mode 100644
index 0000000000..299d8005e8
--- /dev/null
+++ b/spec/bundler/bundler/ci_detector_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+RSpec.describe Bundler::CIDetector do
+ # This is properly tested in rubygems, under the name Gem::CIDetector
+ # But the test that confirms that our version _stays in sync_ with that version
+ # will live here.
+
+ it "stays in sync with the rubygems implementation" do
+ rubygems_implementation_path = File.join(git_root, "lib", "rubygems", "ci_detector.rb")
+ expect(File.exist?(rubygems_implementation_path)).to be_truthy
+ rubygems_code = File.read(rubygems_implementation_path)
+ denamespaced_rubygems_code = rubygems_code.sub("Gem", "NAMESPACE")
+
+ bundler_implementation_path = File.join(source_lib_dir, "bundler", "ci_detector.rb")
+ expect(File.exist?(bundler_implementation_path)).to be_truthy
+ bundler_code = File.read(bundler_implementation_path)
+ denamespaced_bundler_code = bundler_code.sub("Bundler", "NAMESPACE")
+
+ expect(denamespaced_bundler_code).to eq(denamespaced_rubygems_code)
+ end
+end