зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Refactor spec helpers for reading lockfiles
https://github.com/rubygems/rubygems/commit/ea2a30ba08
This commit is contained in:
Родитель
ebc3174123
Коммит
c31a9cf829
|
@ -1,10 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "bundle lock" do
|
||||
def read_lockfile(file = "Gemfile.lock")
|
||||
bundled_app(file).read
|
||||
end
|
||||
|
||||
let(:repo) { gem_repo1 }
|
||||
|
||||
before :each do
|
||||
|
|
|
@ -244,7 +244,7 @@ module Spec
|
|||
contents = args.pop
|
||||
|
||||
if contents.nil?
|
||||
File.open(bundled_app_gemfile, "r", &:read)
|
||||
read_gemfile
|
||||
else
|
||||
create_file(args.pop || "Gemfile", contents)
|
||||
end
|
||||
|
@ -254,12 +254,24 @@ module Spec
|
|||
contents = args.pop
|
||||
|
||||
if contents.nil?
|
||||
File.open(bundled_app_lock, "r", &:read)
|
||||
read_lockfile
|
||||
else
|
||||
create_file(args.pop || "Gemfile.lock", contents)
|
||||
end
|
||||
end
|
||||
|
||||
def read_gemfile(file = "Gemfile")
|
||||
read_bundled_app_file(file)
|
||||
end
|
||||
|
||||
def read_lockfile(file = "Gemfile.lock")
|
||||
read_bundled_app_file(file)
|
||||
end
|
||||
|
||||
def read_bundled_app_file(file)
|
||||
bundled_app(file).read
|
||||
end
|
||||
|
||||
def strip_whitespace(str)
|
||||
# Trim the leading spaces
|
||||
spaces = str[/\A\s+/, 0] || ""
|
||||
|
|
Загрузка…
Ссылка в новой задаче