2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-14 05:49:16 -05:00
|
|
|
require_relative "../support/path"
|
2019-11-18 09:36:51 -05:00
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
RSpec.describe "bundle version" do
|
2019-11-18 09:36:51 -05:00
|
|
|
if Spec::Path.ruby_core?
|
2019-12-14 05:49:16 -05:00
|
|
|
COMMIT_HASH = /unknown|[a-fA-F0-9]{7,}/.freeze
|
2019-11-18 09:36:51 -05:00
|
|
|
else
|
2019-12-14 05:49:16 -05:00
|
|
|
COMMIT_HASH = /[a-fA-F0-9]{7,}/.freeze
|
2019-11-18 09:36:51 -05:00
|
|
|
end
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
context "with -v" do
|
2019-01-04 08:10:58 -05:00
|
|
|
it "outputs the version", :bundler => "< 3" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "-v"
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(out).to eq("Bundler version #{Bundler::VERSION}")
|
|
|
|
end
|
|
|
|
|
2019-01-04 08:10:58 -05:00
|
|
|
it "outputs the version", :bundler => "3" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "-v"
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(out).to eq(Bundler::VERSION)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with --version" do
|
2019-01-04 08:10:58 -05:00
|
|
|
it "outputs the version", :bundler => "< 3" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "--version"
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(out).to eq("Bundler version #{Bundler::VERSION}")
|
|
|
|
end
|
|
|
|
|
2019-01-04 08:10:58 -05:00
|
|
|
it "outputs the version", :bundler => "3" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "--version"
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(out).to eq(Bundler::VERSION)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with version" do
|
2019-01-04 08:10:58 -05:00
|
|
|
it "outputs the version with build metadata", :bundler => "< 3" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "version"
|
2019-11-18 09:36:51 -05:00
|
|
|
expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2019-01-04 08:10:58 -05:00
|
|
|
it "outputs the version with build metadata", :bundler => "3" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "version"
|
2019-11-18 09:36:51 -05:00
|
|
|
expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|