blob: 736f2ad45cf48485e882ff25d843aba5f17f6139 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DesignManagement::GitRepository, feature_category: :design_management do
let_it_be(:container_repo) { DesignManagement::Repository.new(project: create(:project)) }
let(:git_repository) { container_repo.repository }
shared_examples 'returns parsed git attributes that enable LFS for all file types' do
it do
expect(subject.patterns).to be_a_kind_of(Hash)
expect(subject.patterns).to have_key('/designs/*')
expect(subject.patterns['/designs/*']).to eql(
{ "filter" => "lfs", "diff" => "lfs", "merge" => "lfs", "text" => false }
)
end
end
describe '.container' do
it 'is of class DesignManagement::Repository' do
expect(git_repository.container).to be_a_kind_of(DesignManagement::Repository)
end
end
describe "#info_attributes" do
subject { git_repository.info_attributes }
include_examples 'returns parsed git attributes that enable LFS for all file types'
end
describe '#attributes_at' do
subject { git_repository.attributes_at }
include_examples 'returns parsed git attributes that enable LFS for all file types'
end
describe '#gitattribute' do
it 'returns a gitattribute when path has gitattributes' do
expect(git_repository.gitattribute('/designs/file.txt', 'filter')).to eq('lfs')
end
it 'returns nil when path has no gitattributes' do
expect(git_repository.gitattribute('/invalid/file.txt', 'filter')).to be_nil
end
end
describe '#copy_gitattributes' do
it 'always returns regardless of whether given a valid or invalid ref' do
expect(git_repository.copy_gitattributes('master')).to be true
expect(git_repository.copy_gitattributes('invalid')).to be true
end
end
describe '#attributes' do
it 'confirms that all files are LFS enabled' do
%w[png zip anything].each do |filetype|
path = "/#{DesignManagement.designs_directory}/file.#{filetype}"
attributes = git_repository.attributes(path)
expect(attributes['filter']).to eq('lfs')
end
end
end
end
|