diff options
| author | Sean McGivern <sean@mcgivern.me.uk> | 2018-02-06 16:24:54 +0000 |
|---|---|---|
| committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-02-06 16:24:54 +0000 |
| commit | f81306e76fa16458d8ea72c2e7edf76af822610d (patch) | |
| tree | 18bcfc28e29efe4891ede4b3fa3c085eef740dde /spec/lib | |
| parent | ba62493009c2360018709b660956a6173f3e1515 (diff) | |
| parent | d2a77094ae4a44b63fbe22ca910e836cb336a729 (diff) | |
| download | gitlab-ce-f81306e76fa16458d8ea72c2e7edf76af822610d.tar.gz | |
Merge branch 'jej/upload-file-tracks-lfs' into 'master'
File upload UI obeys LFS filter
Closes #29876
See merge request gitlab-org/gitlab-ce!16412
Diffstat (limited to 'spec/lib')
| -rw-r--r-- | spec/lib/gitlab/git/lfs_pointer_file_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/lfs_pointer_file_spec.rb b/spec/lib/gitlab/git/lfs_pointer_file_spec.rb new file mode 100644 index 00000000000..d7f76737f3f --- /dev/null +++ b/spec/lib/gitlab/git/lfs_pointer_file_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe Gitlab::Git::LfsPointerFile do + let(:data) { "1234\n" } + + subject { described_class.new(data) } + + describe '#size' do + it 'counts the bytes' do + expect(subject.size).to eq 5 + end + + it 'handles non ascii data' do + expect(described_class.new("รครครครค").size).to eq 8 + end + end + + describe '#sha256' do + it 'hashes the content correctly' do + expect(subject.sha256).to eq 'a883dafc480d466ee04e0d6da986bd78eb1fdd2178d04693723da3a8f95d42f4' + end + end + + describe '#pointer' do + it 'starts with the LFS version' do + expect(subject.pointer).to start_with('version https://git-lfs.github.com/spec/v1') + end + + it 'includes sha256' do + expect(subject.pointer).to match(/^oid sha256:[0-9a-fA-F]{64}/) + end + + it 'ends with the size' do + expect(subject.pointer).to end_with("\nsize 5\n") + end + end +end |
