HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.6.8/spec/bundler/commands/version_spec.rb
# frozen_string_literal: true

RSpec.describe "bundle version" do
  context "with -v" do
    it "outputs the version", :bundler => "< 2" do
      bundle! "-v"
      expect(out).to eq("Bundler version #{Bundler::VERSION}")
    end

    it "outputs the version", :bundler => "2" do
      bundle! "-v"
      expect(out).to eq(Bundler::VERSION)
    end
  end

  context "with --version" do
    it "outputs the version", :bundler => "< 2" do
      bundle! "--version"
      expect(out).to eq("Bundler version #{Bundler::VERSION}")
    end

    it "outputs the version", :bundler => "2" do
      bundle! "--version"
      expect(out).to eq(Bundler::VERSION)
    end
  end

  context "with version" do
    it "outputs the version with build metadata", :bundler => "< 2" 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/)
    end

    it "outputs the version with build metadata", :bundler => "2" 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/)
    end
  end
end