blob: 53d545f5faf454dc972c9368b03190d2f3b7af78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# 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,}/.freeze
else
COMMIT_HASH = /[a-fA-F0-9]{7,}/.freeze
end
context "with -v" do
it "outputs the version", :bundler => "< 3" do
bundle "-v"
expect(out).to eq("Bundler version #{Bundler::VERSION}")
end
it "outputs the version", :bundler => "3" do
bundle "-v"
expect(out).to eq(Bundler::VERSION)
end
end
context "with --version" do
it "outputs the version", :bundler => "< 3" do
bundle "--version"
expect(out).to eq("Bundler version #{Bundler::VERSION}")
end
it "outputs the version", :bundler => "3" do
bundle "--version"
expect(out).to eq(Bundler::VERSION)
end
end
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 #{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 #{COMMIT_HASH}\)\z/)
end
end
end
|