From 1a62a50c4f9c835dee5d6bc17ca45914daea1bbd Mon Sep 17 00:00:00 2001 From: Vyacheslav Alexeev Date: Fri, 10 Dec 2021 15:40:58 +0800 Subject: [rubygems/rubygems] Add `github` and `ref` options to `bundle add` https://github.com/rubygems/rubygems/commit/c3e54acab0 --- spec/bundler/commands/add_spec.rb | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'spec/bundler') diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb index 093ec53fea..96ea238063 100644 --- a/spec/bundler/commands/add_spec.rb +++ b/spec/bundler/commands/add_spec.rb @@ -104,7 +104,7 @@ RSpec.describe "bundle add" do end describe "with --git" do - it "adds dependency with specified github source" do + it "adds dependency with specified git source" do bundle "add foo --git=#{lib_path("foo-2.0")}" expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :git => "#{lib_path("foo-2.0")}"/) @@ -117,7 +117,7 @@ RSpec.describe "bundle add" do update_git "foo", "2.0", :branch => "test" end - it "adds dependency with specified github source and branch" do + it "adds dependency with specified git source and branch" do bundle "add foo --git=#{lib_path("foo-2.0")} --branch=test" expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :git => "#{lib_path("foo-2.0")}", :branch => "test"/) @@ -125,6 +125,39 @@ RSpec.describe "bundle add" do end end + describe "with --git and --ref" do + it "adds dependency with specified git source and branch" do + bundle "add foo --git=#{lib_path("foo-2.0")} --ref=#{revision_for(lib_path("foo-2.0"))}" + + expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2\.0", :git => "#{lib_path("foo-2.0")}", :ref => "#{revision_for(lib_path("foo-2.0"))}"/) + expect(the_bundle).to include_gems "foo 2.0" + end + end + + describe "with --github" do + it "adds dependency with specified github source" do + bundle "add rake --github=ruby/rake" + + expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.0", :github => "ruby\/rake"}) + end + end + + describe "with --github and --branch" do + it "adds dependency with specified github source and branch" do + bundle "add rake --github=ruby/rake --branch=master" + + expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.0", :github => "ruby\/rake", :branch => "master"}) + end + end + + describe "with --github and --ref" do + it "adds dependency with specified github source and ref" do + bundle "add rake --github=ruby/rake --ref=5c60da8" + + expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.0", :github => "ruby\/rake", :ref => "5c60da8"}) + end + end + describe "with --skip-install" do it "adds gem to Gemfile but is not installed" do bundle "add foo --skip-install --version=2.0" -- cgit v1.2.3