[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
@ -151,7 +151,7 @@ module Bundler
|
|||||||
def to_lock
|
def to_lock
|
||||||
out = super
|
out = super
|
||||||
out << "!" if source
|
out << "!" if source
|
||||||
out << "\n"
|
out
|
||||||
end
|
end
|
||||||
|
|
||||||
def specific?
|
def specific?
|
||||||
|
@ -60,7 +60,7 @@ module Bundler
|
|||||||
handled = []
|
handled = []
|
||||||
definition.dependencies.sort_by(&:to_s).each do |dep|
|
definition.dependencies.sort_by(&:to_s).each do |dep|
|
||||||
next if handled.include?(dep.name)
|
next if handled.include?(dep.name)
|
||||||
out << dep.to_lock
|
out << dep.to_lock << "\n"
|
||||||
handled << dep.name
|
handled << dep.name
|
||||||
end
|
end
|
||||||
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…
x
Reference in New Issue
Block a user