mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Bundler: make to_lock consistent between Gem::Dependency and Bundler::Dependency
https://github.com/rubygems/rubygems/commit/971d57cf5a
This commit is contained in:
parent
13d2225c46
commit
381d8e43ce
3 changed files with 39 additions and 2 deletions
|
@ -151,7 +151,7 @@ module Bundler
|
|||
def to_lock
|
||||
out = super
|
||||
out << "!" if source
|
||||
out << "\n"
|
||||
out
|
||||
end
|
||||
|
||||
def specific?
|
||||
|
|
|
@ -60,7 +60,7 @@ module Bundler
|
|||
handled = []
|
||||
definition.dependencies.sort_by(&:to_s).each do |dep|
|
||||
next if handled.include?(dep.name)
|
||||
out << dep.to_lock
|
||||
out << dep.to_lock << "\n"
|
||||
handled << dep.name
|
||||
end
|
||||
end
|
||||
|
|
37
spec/bundler/bundler/dependency_spec.rb
Normal file
37
spec/bundler/bundler/dependency_spec.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Bundler::Dependency do
|
||||
let(:options) do
|
||||
{}
|
||||
end
|
||||
let(:dependency) do
|
||||
described_class.new(
|
||||
"test_gem",
|
||||
"1.0.0",
|
||||
options
|
||||
)
|
||||
end
|
||||
|
||||
describe "to_lock" do
|
||||
it "returns formatted string" do
|
||||
expect(dependency.to_lock).to eq(" test_gem (= 1.0.0)")
|
||||
end
|
||||
|
||||
it "matches format of Gem::Dependency#to_lock" do
|
||||
gem_dependency = Gem::Dependency.new("test_gem", "1.0.0")
|
||||
expect(dependency.to_lock).to eq(gem_dependency.to_lock)
|
||||
end
|
||||
|
||||
context "when source is passed" do
|
||||
let(:options) do
|
||||
{
|
||||
"source" => Bundler::Source::Git.new({}),
|
||||
}
|
||||
end
|
||||
|
||||
it "returns formatted string with exclamation mark" do
|
||||
expect(dependency.to_lock).to eq(" test_gem (= 1.0.0)!")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue