diff options
| author | gabriele renzi <gabriele@toptal.com> | 2021-09-30 13:51:08 +0200 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-10-09 08:03:43 +0900 |
| commit | ad92651d6428d59b7f4dbee7014f4d1127bbdbe8 (patch) | |
| tree | c4444dfbdf7ba35e2e19b843f1a43ac46f634db6 /spec | |
| parent | 06c3e80611b81ec8f251957328486e9b6dd18d3b (diff) | |
[rubygems/rubygems] Add glob infomation to Bundler::Source::Git#to_s
The glob information was not specified in the string representation for
a source, which led to non-deterministic behaviour when generating the
lockfile, since sources are sorted by this value.
https://github.com/rubygems/rubygems/commit/493b880abc
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/bundler/source/git_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/bundler/bundler/source/git_spec.rb b/spec/bundler/bundler/source/git_spec.rb index 6668b6e69a..ed6dc3cd29 100644 --- a/spec/bundler/bundler/source/git_spec.rb +++ b/spec/bundler/bundler/source/git_spec.rb @@ -24,5 +24,50 @@ RSpec.describe Bundler::Source::Git do expect(subject.to_s).to eq "https://x-oauth-basic@github.com/foo/bar.git" end end + + context "when the source has a glob specifier" do + let(:glob) { "bar/baz/*.gemspec" } + let(:options) do + { "uri" => uri, "glob" => glob } + end + + it "includes it" do + expect(subject.to_s).to eq "https://github.com/foo/bar.git (glob: bar/baz/*.gemspec)" + end + end + + context "when the source has a reference" do + let(:git_proxy_stub) do + instance_double(Bundler::Source::Git::GitProxy, :revision => "123abc", :branch => "v1.0.0") + end + let(:options) do + { "uri" => uri, "ref" => "v1.0.0" } + end + + before do + allow(Bundler::Source::Git::GitProxy).to receive(:new).and_return(git_proxy_stub) + end + + it "includes it" do + expect(subject.to_s).to eq "https://github.com/foo/bar.git (at v1.0.0@123abc)" + end + end + + context "when the source has both reference and glob specifiers" do + let(:git_proxy_stub) do + instance_double(Bundler::Source::Git::GitProxy, :revision => "123abc", :branch => "v1.0.0") + end + let(:options) do + { "uri" => uri, "ref" => "v1.0.0", "glob" => "gems/foo/*.gemspec" } + end + + before do + allow(Bundler::Source::Git::GitProxy).to receive(:new).and_return(git_proxy_stub) + end + + it "includes both" do + expect(subject.to_s).to eq "https://github.com/foo/bar.git (at v1.0.0@123abc, glob: gems/foo/*.gemspec)" + end + end end end |
