summaryrefslogtreecommitdiff
path: root/spec/services/lfs
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-05-06 12:51:49 +0000
committerNick Thomas <nick@gitlab.com>2019-05-06 12:51:49 +0000
commite20e062737631e37904b54c73539e6846cd5a1e7 (patch)
tree7f43714d2d4f7e6bf7b60736a943925dcf1ff0c0 /spec/services/lfs
parent38d57a61b6d960b2997578a0a12a40fa686c30ea (diff)
downloadgitlab-ce-e20e062737631e37904b54c73539e6846cd5a1e7.tar.gz
Fix uploading of LFS tracked file through UI
Diffstat (limited to 'spec/services/lfs')
-rw-r--r--spec/services/lfs/file_transformer_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/services/lfs/file_transformer_spec.rb b/spec/services/lfs/file_transformer_spec.rb
index 2c6e86069f3..888eea6e91e 100644
--- a/spec/services/lfs/file_transformer_spec.rb
+++ b/spec/services/lfs/file_transformer_spec.rb
@@ -64,6 +64,25 @@ describe Lfs::FileTransformer do
expect(result.encoding).to eq('text')
end
+ context 'when an actual file is passed' do
+ let(:file) { Tempfile.new(file_path) }
+
+ before do
+ file.write(file_content)
+ file.rewind
+ end
+
+ after do
+ file.unlink
+ end
+
+ it "creates an LfsObject with the file's content" do
+ subject.new_file(file_path, file)
+
+ expect(LfsObject.last.file.read).to eq file_content
+ end
+ end
+
context "when doesn't use LFS" do
let(:file_path) { 'other.filetype' }