1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/bundler/commands/version_spec.rb

48 lines
1.3 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2019-11-18 09:36:51 -05:00
require_relative '../support/path'
RSpec.describe "bundle version" do
2019-11-18 09:36:51 -05:00
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"
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"
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/)
end
it "outputs the version with build metadata", :bundler => "3" do
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/)
end
end
end