diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/commands/version_spec.rb | 12 |
1 files 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 |