Extract constant for LfsPointerFile::VERSION_LINE
This commit is contained in:
parent
9d32fccfa7
commit
c1e3942122
4 changed files with 10 additions and 7 deletions
|
@ -1,13 +1,16 @@
|
|||
module Gitlab
|
||||
module Git
|
||||
class LfsPointerFile
|
||||
VERSION = "https://git-lfs.github.com/spec/v1".freeze
|
||||
VERSION_LINE = "version #{VERSION}".freeze
|
||||
|
||||
def initialize(data)
|
||||
@data = data
|
||||
end
|
||||
|
||||
def pointer
|
||||
@pointer ||= <<~FILE
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
#{VERSION_LINE}
|
||||
oid sha256:#{sha256}
|
||||
size #{size}
|
||||
FILE
|
||||
|
|
|
@ -43,7 +43,7 @@ describe Files::CreateService do
|
|||
|
||||
blob = repository.blob_at('lfs', file_path)
|
||||
|
||||
expect(blob.data).not_to start_with('version https://git-lfs.github.com/spec/v1')
|
||||
expect(blob.data).not_to start_with(Gitlab::Git::LfsPointerFile::VERSION_LINE)
|
||||
expect(blob.data).to eq(file_content)
|
||||
end
|
||||
end
|
||||
|
@ -58,7 +58,7 @@ describe Files::CreateService do
|
|||
|
||||
blob = repository.blob_at('lfs', file_path)
|
||||
|
||||
expect(blob.data).to start_with('version https://git-lfs.github.com/spec/v1')
|
||||
expect(blob.data).to start_with(Gitlab::Git::LfsPointerFile::VERSION_LINE)
|
||||
end
|
||||
|
||||
it "creates an LfsObject with the file's content" do
|
||||
|
|
|
@ -126,7 +126,7 @@ describe Files::MultiService do
|
|||
|
||||
blob = repository.blob_at('lfs', new_file_path)
|
||||
|
||||
expect(blob.data).to start_with('version https://git-lfs.github.com/spec/v1')
|
||||
expect(blob.data).to start_with(Gitlab::Git::LfsPointerFile::VERSION_LINE)
|
||||
end
|
||||
|
||||
it "creates an LfsObject with the file's content" do
|
||||
|
@ -145,7 +145,7 @@ describe Files::MultiService do
|
|||
|
||||
blob = repository.blob_at('lfs', new_file_path)
|
||||
|
||||
expect(blob.data).to start_with('version https://git-lfs.github.com/spec/v1')
|
||||
expect(blob.data).to start_with(Gitlab::Git::LfsPointerFile::VERSION_LINE)
|
||||
end
|
||||
|
||||
it "creates an LfsObject with the file's content" do
|
||||
|
|
|
@ -53,7 +53,7 @@ describe Lfs::FileTransformer do
|
|||
it 'returns an LFS pointer' do
|
||||
result = subject.new_file(file_path, file_content)
|
||||
|
||||
expect(result.content).to start_with('version https://git-lfs.github.com/spec/v1')
|
||||
expect(result.content).to start_with(Gitlab::Git::LfsPointerFile::VERSION_LINE)
|
||||
end
|
||||
|
||||
it 'returns LFS pointer encoding as text' do
|
||||
|
@ -68,7 +68,7 @@ describe Lfs::FileTransformer do
|
|||
it "doesn't create LFS pointers" do
|
||||
new_content = subject.new_file(file_path, file_content).content
|
||||
|
||||
expect(new_content).not_to start_with('version https://git-lfs.github.com/spec/v1')
|
||||
expect(new_content).not_to start_with(Gitlab::Git::LfsPointerFile::VERSION_LINE)
|
||||
expect(new_content).to eq(file_content)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue