From e9992bcab03b1646d18b4a417643273a7bbb6158 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Mon, 18 Nov 2019 23:36:51 +0900 Subject: Allow unknown if ruby core --- spec/bundler/commands/version_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/bundler/commands/version_spec.rb b/spec/bundler/commands/version_spec.rb index 66c7930397..f85ac82a40 100644 --- a/spec/bundler/commands/version_spec.rb +++ b/spec/bundler/commands/version_spec.rb @@ -1,6 +1,14 @@ # frozen_string_literal: true +require_relative '../support/path' + RSpec.describe "bundle version" do + if Spec::Path.ruby_core? + COMMIT_HASH = /unknown|[a-fA-F0-9]{7,}/ + else + COMMIT_HASH = /[a-fA-F0-9]{7,}/ + end + context "with -v" do it "outputs the version", :bundler => "< 3" do bundle! "-v" @@ -28,12 +36,12 @@ RSpec.describe "bundle version" do context "with version" do it "outputs the version with build metadata", :bundler => "< 3" do bundle! "version" - expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) + expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end it "outputs the version with build metadata", :bundler => "3" do bundle! "version" - expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) + expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end end end -- cgit v1.2.3