Commit c1e39421 authored by James Edwards-Jones's avatar James Edwards-Jones

Extract constant for LfsPointerFile::VERSION_LINE

parent 9d32fccf
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment