Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-03-13 03:55:49 +0300
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-03-16 00:49:01 +0300
commit1f5e809c047d9561fe03d04c51b1dc4fffd95e04 (patch)
treed8bd865e43e592e846adcc1a3de02e36c4fd982a /spec/services/lfs
parentca66a04ffec2e311e72b5bdd2c68d3286ef6631c (diff)
Use correct encoding with Lfs::FileTransfromer
Diffstat (limited to 'spec/services/lfs')
-rw-r--r--spec/services/lfs/file_transformer_spec.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/spec/services/lfs/file_transformer_spec.rb b/spec/services/lfs/file_transformer_spec.rb
index 6d17ab03ac3..00c5328a3a0 100644
--- a/spec/services/lfs/file_transformer_spec.rb
+++ b/spec/services/lfs/file_transformer_spec.rb
@@ -16,6 +16,18 @@ describe Lfs::FileTransformer do
subject.new_file(file_path, file_content)
end
+
+ it 'returns untransformed content' do
+ result = subject.new_file(file_path, file_content)
+
+ expect(result.content).to eq(file_content)
+ end
+
+ it 'returns untransformed encoding' do
+ result = subject.new_file(file_path, file_content, encoding: 'base64')
+
+ expect(result.encoding).to eq('base64')
+ end
end
context 'with lfs enabled' do
@@ -38,17 +50,23 @@ describe Lfs::FileTransformer do
expect(LfsObject.last.file.read).to eq file_content
end
- it 'creates an LFS pointer' do
- new_content = subject.new_file(file_path, file_content)
+ 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')
+ end
+
+ it 'returns LFS pointer encoding as text' do
+ result = subject.new_file(file_path, file_content, encoding: 'base64')
- expect(new_content).to start_with('version https://git-lfs.github.com/spec/v1')
+ expect(result.encoding).to eq('text')
end
context "when doesn't use LFS" do
let(:file_path) { 'other.filetype' }
it "doesn't create LFS pointers" do
- new_content = subject.new_file(file_path, file_content)
+ 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).to eq(file_content)