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:
Diffstat (limited to 'spec/models/design_management/repository_spec.rb')
-rw-r--r--spec/models/design_management/repository_spec.rb57
1 files changed, 12 insertions, 45 deletions
diff --git a/spec/models/design_management/repository_spec.rb b/spec/models/design_management/repository_spec.rb
index 0115e0c139c..74f393306dc 100644
--- a/spec/models/design_management/repository_spec.rb
+++ b/spec/models/design_management/repository_spec.rb
@@ -2,57 +2,24 @@
require 'spec_helper'
-RSpec.describe DesignManagement::Repository do
- let(:project) { create(:project) }
- let(:repository) { described_class.new(project) }
+RSpec.describe DesignManagement::Repository, feature_category: :design_management do
+ let_it_be(:project) { create(:project) }
+ let(:subject) { described_class.new({ project: project }) }
- 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
+ describe 'associations' do
+ it { is_expected.to belong_to(:project).inverse_of(:design_management_repository) }
end
- describe "#info_attributes" do
- subject { repository.info_attributes }
-
- include_examples 'returns parsed git attributes that enable LFS for all file types'
- end
-
- describe '#attributes_at' do
- subject { repository.attributes_at }
-
- include_examples 'returns parsed git attributes that enable LFS for all file types'
+ describe 'validations' do
+ it { is_expected.to validate_presence_of(:project) }
+ it { is_expected.to validate_uniqueness_of(:project) }
end
- describe '#gitattribute' do
- it 'returns a gitattribute when path has gitattributes' do
- expect(repository.gitattribute('/designs/file.txt', 'filter')).to eq('lfs')
- end
-
- it 'returns nil when path has no gitattributes' do
- expect(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(repository.copy_gitattributes('master')).to be true
- expect(repository.copy_gitattributes('invalid')).to be true
- end
+ it "returns the project's full path" do
+ expect(subject.full_path).to eq(project.full_path + Gitlab::GlRepository::DESIGN.path_suffix)
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 = repository.attributes(path)
-
- expect(attributes['filter']).to eq('lfs')
- end
- end
+ it "returns the project's disk path" do
+ expect(subject.disk_path).to eq(project.disk_path + Gitlab::GlRepository::DESIGN.path_suffix)
end
end