Merge branch 'group-specific-lfs-settings' into 'master'
Added group-specific setting for LFS. Groups can enable/disable LFS, but this setting can be overridden at the project level. **Admin only** Closes #18092 See merge request !6164
This commit is contained in:
commit
6e4582f2f2
|
@ -76,7 +76,8 @@ v 8.12.0 (unreleased)
|
||||||
- Add last commit time to repo view (ClemMakesApps)
|
- Add last commit time to repo view (ClemMakesApps)
|
||||||
- Fix accessibility and visibility of project list dropdown button !6140
|
- Fix accessibility and visibility of project list dropdown button !6140
|
||||||
- Fix missing flash messages on service edit page (airatshigapov)
|
- Fix missing flash messages on service edit page (airatshigapov)
|
||||||
- Added project specific enable/disable setting for LFS !5997
|
- Added project-specific enable/disable setting for LFS !5997
|
||||||
|
- Added group-specific enable/disable setting for LFS !6164
|
||||||
- Don't expose a user's token in the `/api/v3/user` API (!6047)
|
- Don't expose a user's token in the `/api/v3/user` API (!6047)
|
||||||
- Remove redundant js-timeago-pending from user activity log (ClemMakesApps)
|
- Remove redundant js-timeago-pending from user activity log (ClemMakesApps)
|
||||||
- Ability to manage project issues, snippets, wiki, merge requests and builds access level
|
- Ability to manage project issues, snippets, wiki, merge requests and builds access level
|
||||||
|
|
|
@ -60,6 +60,14 @@ class Admin::GroupsController < Admin::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_params
|
def group_params
|
||||||
params.require(:group).permit(:name, :description, :path, :avatar, :visibility_level, :request_access_enabled)
|
params.require(:group).permit(
|
||||||
|
:avatar,
|
||||||
|
:description,
|
||||||
|
:lfs_enabled,
|
||||||
|
:name,
|
||||||
|
:path,
|
||||||
|
:request_access_enabled,
|
||||||
|
:visibility_level
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,7 +121,17 @@ class GroupsController < Groups::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_params
|
def group_params
|
||||||
params.require(:group).permit(:name, :description, :path, :avatar, :public, :visibility_level, :share_with_group_lock, :request_access_enabled)
|
params.require(:group).permit(
|
||||||
|
:avatar,
|
||||||
|
:description,
|
||||||
|
:lfs_enabled,
|
||||||
|
:name,
|
||||||
|
:path,
|
||||||
|
:public,
|
||||||
|
:request_access_enabled,
|
||||||
|
:share_with_group_lock,
|
||||||
|
:visibility_level
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_events
|
def load_events
|
||||||
|
|
|
@ -23,4 +23,29 @@ module GroupsHelper
|
||||||
full_title
|
full_title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def projects_lfs_status(group)
|
||||||
|
lfs_status =
|
||||||
|
if group.lfs_enabled?
|
||||||
|
group.projects.select(&:lfs_enabled?).size
|
||||||
|
else
|
||||||
|
group.projects.reject(&:lfs_enabled?).size
|
||||||
|
end
|
||||||
|
|
||||||
|
size = group.projects.size
|
||||||
|
|
||||||
|
if lfs_status == size
|
||||||
|
'for all projects'
|
||||||
|
else
|
||||||
|
"for #{lfs_status} out of #{pluralize(size, 'project')}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def group_lfs_status(group)
|
||||||
|
status = group.lfs_enabled? ? 'enabled' : 'disabled'
|
||||||
|
|
||||||
|
content_tag(:span, class: "lfs-#{status}") do
|
||||||
|
"#{status.humanize} #{projects_lfs_status(group)}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -95,6 +95,13 @@ class Group < Namespace
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def lfs_enabled?
|
||||||
|
return false unless Gitlab.config.lfs.enabled
|
||||||
|
return Gitlab.config.lfs.enabled if self[:lfs_enabled].nil?
|
||||||
|
|
||||||
|
self[:lfs_enabled]
|
||||||
|
end
|
||||||
|
|
||||||
def add_users(user_ids, access_level, current_user: nil, expires_at: nil)
|
def add_users(user_ids, access_level, current_user: nil, expires_at: nil)
|
||||||
user_ids.each do |user_id|
|
user_ids.each do |user_id|
|
||||||
Member.add_user(
|
Member.add_user(
|
||||||
|
|
|
@ -141,6 +141,11 @@ class Namespace < ActiveRecord::Base
|
||||||
projects.joins(:forked_project_link).find_by('forked_project_links.forked_from_project_id = ?', project.id)
|
projects.joins(:forked_project_link).find_by('forked_project_links.forked_from_project_id = ?', project.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def lfs_enabled?
|
||||||
|
# User namespace will always default to the global setting
|
||||||
|
Gitlab.config.lfs.enabled
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def repository_storage_paths
|
def repository_storage_paths
|
||||||
|
|
|
@ -393,10 +393,9 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def lfs_enabled?
|
def lfs_enabled?
|
||||||
return false unless Gitlab.config.lfs.enabled
|
return namespace.lfs_enabled? if self[:lfs_enabled].nil?
|
||||||
return Gitlab.config.lfs.enabled if self[:lfs_enabled].nil?
|
|
||||||
|
|
||||||
self[:lfs_enabled]
|
self[:lfs_enabled] && Gitlab.config.lfs.enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
def repository_storage_path
|
def repository_storage_path
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
.col-sm-offset-2.col-sm-10
|
.col-sm-offset-2.col-sm-10
|
||||||
= render 'shared/allow_request_access', form: f
|
= render 'shared/allow_request_access', form: f
|
||||||
|
|
||||||
|
= render 'groups/group_lfs_settings', f: f
|
||||||
|
|
||||||
- if @group.new_record?
|
- if @group.new_record?
|
||||||
.form-group
|
.form-group
|
||||||
.col-sm-offset-2.col-sm-10
|
.col-sm-offset-2.col-sm-10
|
||||||
|
|
|
@ -37,6 +37,12 @@
|
||||||
%strong
|
%strong
|
||||||
= @group.created_at.to_s(:medium)
|
= @group.created_at.to_s(:medium)
|
||||||
|
|
||||||
|
%li
|
||||||
|
%span.light Group Git LFS status:
|
||||||
|
%strong
|
||||||
|
= group_lfs_status(@group)
|
||||||
|
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
|
||||||
|
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-heading
|
.panel-heading
|
||||||
%h3.panel-title
|
%h3.panel-title
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
- if current_user.admin?
|
||||||
|
.form-group
|
||||||
|
.col-sm-offset-2.col-sm-10
|
||||||
|
.checkbox
|
||||||
|
= f.label :lfs_enabled do
|
||||||
|
= f.check_box :lfs_enabled, checked: @group.lfs_enabled?
|
||||||
|
%strong
|
||||||
|
Allow projects within this group to use Git LFS
|
||||||
|
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
|
||||||
|
%br/
|
||||||
|
%span.descr This setting can be overridden in each project.
|
|
@ -25,6 +25,8 @@
|
||||||
.col-sm-offset-2.col-sm-10
|
.col-sm-offset-2.col-sm-10
|
||||||
= render 'shared/allow_request_access', form: f
|
= render 'shared/allow_request_access', form: f
|
||||||
|
|
||||||
|
= render 'group_lfs_settings', f: f
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
%hr
|
%hr
|
||||||
= f.label :share_with_group_lock, class: 'control-label' do
|
= f.label :share_with_group_lock, class: 'control-label' do
|
||||||
|
|
|
@ -84,15 +84,14 @@
|
||||||
= project_feature_access_select(:snippets_access_level)
|
= project_feature_access_select(:snippets_access_level)
|
||||||
|
|
||||||
- if Gitlab.config.lfs.enabled && current_user.admin?
|
- if Gitlab.config.lfs.enabled && current_user.admin?
|
||||||
.form-group
|
.row
|
||||||
.checkbox
|
.col-md-9
|
||||||
= f.label :lfs_enabled do
|
= f.label :lfs_enabled, 'LFS', class: 'label-light'
|
||||||
= f.check_box :lfs_enabled, checked: @project.lfs_enabled?
|
%span.help-block
|
||||||
%strong LFS
|
Git Large File Storage
|
||||||
%br
|
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
|
||||||
%span.descr
|
.col-md-3
|
||||||
Git Large File Storage
|
= f.select :lfs_enabled, [%w(Enabled true), %w(Disabled false)], {}, selected: @project.lfs_enabled?, class: 'pull-right form-control'
|
||||||
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
|
|
||||||
|
|
||||||
- if Gitlab.config.registry.enabled
|
- if Gitlab.config.registry.enabled
|
||||||
.form-group
|
.form-group
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.form-group.project-visibility-level-holder
|
.form-group.project-visibility-level-holder
|
||||||
= f.label :visibility_level, class: 'control-label' do
|
= f.label :visibility_level, class: 'control-label' do
|
||||||
Visibility Level
|
Visibility Level
|
||||||
= link_to "(?)", help_page_path("public_access/public_access")
|
= link_to icon('question-circle'), help_page_path("public_access/public_access")
|
||||||
.col-sm-10
|
.col-sm-10
|
||||||
- if can_change_visibility_level
|
- if can_change_visibility_level
|
||||||
= render('shared/visibility_radios', model_method: :visibility_level, form: f, selected_level: visibility_level, form_model: form_model)
|
= render('shared/visibility_radios', model_method: :visibility_level, form: f, selected_level: visibility_level, form_model: form_model)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
|
||||||
|
# for more information on how to write migrations for GitLab.
|
||||||
|
|
||||||
|
class AddLfsEnabledToNamespaces < ActiveRecord::Migration
|
||||||
|
include Gitlab::Database::MigrationHelpers
|
||||||
|
|
||||||
|
DOWNTIME = false
|
||||||
|
|
||||||
|
def change
|
||||||
|
add_column :namespaces, :lfs_enabled, :boolean
|
||||||
|
end
|
||||||
|
end
|
|
@ -650,6 +650,7 @@ ActiveRecord::Schema.define(version: 20160913162434) do
|
||||||
t.integer "visibility_level", default: 20, null: false
|
t.integer "visibility_level", default: 20, null: false
|
||||||
t.boolean "request_access_enabled", default: true, null: false
|
t.boolean "request_access_enabled", default: true, null: false
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
|
t.boolean "lfs_enabled"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "namespaces", ["created_at"], name: "index_namespaces_on_created_at", using: :btree
|
add_index "namespaces", ["created_at"], name: "index_namespaces_on_created_at", using: :btree
|
||||||
|
|
|
@ -288,6 +288,7 @@ Parameters:
|
||||||
- `path` (required) - The path of the group
|
- `path` (required) - The path of the group
|
||||||
- `description` (optional) - The group's description
|
- `description` (optional) - The group's description
|
||||||
- `visibility_level` (optional) - The group's visibility. 0 for private, 10 for internal, 20 for public.
|
- `visibility_level` (optional) - The group's visibility. 0 for private, 10 for internal, 20 for public.
|
||||||
|
- `lfs_enabled` (optional) - Enable/disable Large File Storage (LFS) for the projects in this group
|
||||||
|
|
||||||
## Transfer project to group
|
## Transfer project to group
|
||||||
|
|
||||||
|
@ -317,6 +318,7 @@ PUT /groups/:id
|
||||||
| `path` | string | no | The path of the group |
|
| `path` | string | no | The path of the group |
|
||||||
| `description` | string | no | The description of the group |
|
| `description` | string | no | The description of the group |
|
||||||
| `visibility_level` | integer | no | The visibility level of the group. 0 for private, 10 for internal, 20 for public. |
|
| `visibility_level` | integer | no | The visibility level of the group. 0 for private, 10 for internal, 20 for public. |
|
||||||
|
| `lfs_enabled` (optional) | boolean | no | Enable/disable Large File Storage (LFS) for the projects in this group |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/groups/5?name=Experimental"
|
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/groups/5?name=Experimental"
|
||||||
|
|
|
@ -86,7 +86,8 @@ module API
|
||||||
expose(:snippets_enabled) { |project, options| project.feature_available?(:snippets, options[:user]) }
|
expose(:snippets_enabled) { |project, options| project.feature_available?(:snippets, options[:user]) }
|
||||||
|
|
||||||
expose :created_at, :last_activity_at
|
expose :created_at, :last_activity_at
|
||||||
expose :shared_runners_enabled, :lfs_enabled
|
expose :shared_runners_enabled
|
||||||
|
expose :lfs_enabled?, as: :lfs_enabled
|
||||||
expose :creator_id
|
expose :creator_id
|
||||||
expose :namespace
|
expose :namespace
|
||||||
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? }
|
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? }
|
||||||
|
@ -121,6 +122,7 @@ module API
|
||||||
|
|
||||||
class Group < Grape::Entity
|
class Group < Grape::Entity
|
||||||
expose :id, :name, :path, :description, :visibility_level
|
expose :id, :name, :path, :description, :visibility_level
|
||||||
|
expose :lfs_enabled?, as: :lfs_enabled
|
||||||
expose :avatar_url
|
expose :avatar_url
|
||||||
expose :web_url
|
expose :web_url
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,13 +27,14 @@ module API
|
||||||
# path (required) - The path of the group
|
# path (required) - The path of the group
|
||||||
# description (optional) - The description of the group
|
# description (optional) - The description of the group
|
||||||
# visibility_level (optional) - The visibility level of the group
|
# visibility_level (optional) - The visibility level of the group
|
||||||
|
# lfs_enabled (optional) - Enable/disable LFS for the projects in this group
|
||||||
# Example Request:
|
# Example Request:
|
||||||
# POST /groups
|
# POST /groups
|
||||||
post do
|
post do
|
||||||
authorize! :create_group
|
authorize! :create_group
|
||||||
required_attributes! [:name, :path]
|
required_attributes! [:name, :path]
|
||||||
|
|
||||||
attrs = attributes_for_keys [:name, :path, :description, :visibility_level]
|
attrs = attributes_for_keys [:name, :path, :description, :visibility_level, :lfs_enabled]
|
||||||
@group = Group.new(attrs)
|
@group = Group.new(attrs)
|
||||||
|
|
||||||
if @group.save
|
if @group.save
|
||||||
|
@ -51,13 +52,14 @@ module API
|
||||||
# path (optional) - The path of the group
|
# path (optional) - The path of the group
|
||||||
# description (optional) - The description of the group
|
# description (optional) - The description of the group
|
||||||
# visibility_level (optional) - The visibility level of the group
|
# visibility_level (optional) - The visibility level of the group
|
||||||
|
# lfs_enabled (optional) - Enable/disable LFS for the projects in this group
|
||||||
# Example Request:
|
# Example Request:
|
||||||
# PUT /groups/:id
|
# PUT /groups/:id
|
||||||
put ':id' do
|
put ':id' do
|
||||||
group = find_group(params[:id])
|
group = find_group(params[:id])
|
||||||
authorize! :admin_group, group
|
authorize! :admin_group, group
|
||||||
|
|
||||||
attrs = attributes_for_keys [:name, :path, :description, :visibility_level]
|
attrs = attributes_for_keys [:name, :path, :description, :visibility_level, :lfs_enabled]
|
||||||
|
|
||||||
if ::Groups::UpdateService.new(group, current_user, attrs).execute
|
if ::Groups::UpdateService.new(group, current_user, attrs).execute
|
||||||
present group, with: Entities::GroupDetail
|
present group, with: Entities::GroupDetail
|
||||||
|
|
|
@ -18,4 +18,67 @@ describe GroupsHelper do
|
||||||
expect(group_icon(group.path)).to match('group_avatar.png')
|
expect(group_icon(group.path)).to match('group_avatar.png')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'group_lfs_status' do
|
||||||
|
let(:group) { create(:group) }
|
||||||
|
let!(:project) { create(:empty_project, namespace_id: group.id) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'only one project in group' do
|
||||||
|
before do
|
||||||
|
group.update_attribute(:lfs_enabled, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns all projects as enabled' do
|
||||||
|
expect(group_lfs_status(group)).to include('Enabled for all projects')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns all projects as disabled' do
|
||||||
|
project.update_attribute(:lfs_enabled, false)
|
||||||
|
|
||||||
|
expect(group_lfs_status(group)).to include('Enabled for 0 out of 1 project')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'more than one project in group' do
|
||||||
|
before do
|
||||||
|
create(:empty_project, namespace_id: group.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'LFS enabled in group' do
|
||||||
|
before do
|
||||||
|
group.update_attribute(:lfs_enabled, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns both projects as enabled' do
|
||||||
|
expect(group_lfs_status(group)).to include('Enabled for all projects')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns only one as enabled' do
|
||||||
|
project.update_attribute(:lfs_enabled, false)
|
||||||
|
|
||||||
|
expect(group_lfs_status(group)).to include('Enabled for 1 out of 2 projects')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'LFS disabled in group' do
|
||||||
|
before do
|
||||||
|
group.update_attribute(:lfs_enabled, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns both projects as disabled' do
|
||||||
|
expect(group_lfs_status(group)).to include('Disabled for all projects')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns only one as disabled' do
|
||||||
|
project.update_attribute(:lfs_enabled, true)
|
||||||
|
|
||||||
|
expect(group_lfs_status(group)).to include('Disabled for 1 out of 2 projects')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -187,6 +187,52 @@ describe Group, models: true do
|
||||||
it { expect(group.has_master?(@members[:requester])).to be_falsey }
|
it { expect(group.has_master?(@members[:requester])).to be_falsey }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#lfs_enabled?' do
|
||||||
|
context 'LFS enabled globally' do
|
||||||
|
before do
|
||||||
|
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns true when nothing is set' do
|
||||||
|
expect(group.lfs_enabled?).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false when set to false' do
|
||||||
|
group.update_attribute(:lfs_enabled, false)
|
||||||
|
|
||||||
|
expect(group.lfs_enabled?).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns true when set to true' do
|
||||||
|
group.update_attribute(:lfs_enabled, true)
|
||||||
|
|
||||||
|
expect(group.lfs_enabled?).to be_truthy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'LFS disabled globally' do
|
||||||
|
before do
|
||||||
|
allow(Gitlab.config.lfs).to receive(:enabled).and_return(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false when nothing is set' do
|
||||||
|
expect(group.lfs_enabled?).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false when set to false' do
|
||||||
|
group.update_attribute(:lfs_enabled, false)
|
||||||
|
|
||||||
|
expect(group.lfs_enabled?).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false when set to true' do
|
||||||
|
group.update_attribute(:lfs_enabled, true)
|
||||||
|
|
||||||
|
expect(group.lfs_enabled?).to be_falsey
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#owners' do
|
describe '#owners' do
|
||||||
let(:owner) { create(:user) }
|
let(:owner) { create(:user) }
|
||||||
let(:developer) { create(:user) }
|
let(:developer) { create(:user) }
|
||||||
|
|
|
@ -1417,6 +1417,68 @@ describe Project, models: true do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#lfs_enabled?' do
|
||||||
|
let(:project) { create(:project) }
|
||||||
|
|
||||||
|
shared_examples 'project overrides group' do
|
||||||
|
it 'returns true when enabled in project' do
|
||||||
|
project.update_attribute(:lfs_enabled, true)
|
||||||
|
|
||||||
|
expect(project.lfs_enabled?).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns false when disabled in project' do
|
||||||
|
project.update_attribute(:lfs_enabled, false)
|
||||||
|
|
||||||
|
expect(project.lfs_enabled?).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns the value from the namespace, when no value is set in project' do
|
||||||
|
expect(project.lfs_enabled?).to eq(project.namespace.lfs_enabled?)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'LFS disabled in group' do
|
||||||
|
before do
|
||||||
|
project.namespace.update_attribute(:lfs_enabled, false)
|
||||||
|
enable_lfs
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'project overrides group'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'LFS enabled in group' do
|
||||||
|
before do
|
||||||
|
project.namespace.update_attribute(:lfs_enabled, true)
|
||||||
|
enable_lfs
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'project overrides group'
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'LFS disabled globally' do
|
||||||
|
shared_examples 'it always returns false' do
|
||||||
|
it do
|
||||||
|
expect(project.lfs_enabled?).to be_falsey
|
||||||
|
expect(project.namespace.lfs_enabled?).to be_falsey
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when no values are set' do
|
||||||
|
it_behaves_like 'it always returns false'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when all values are set to true' do
|
||||||
|
before do
|
||||||
|
project.namespace.update_attribute(:lfs_enabled, true)
|
||||||
|
project.update_attribute(:lfs_enabled, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'it always returns false'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '.where_paths_in' do
|
describe '.where_paths_in' do
|
||||||
context 'without any paths' do
|
context 'without any paths' do
|
||||||
it 'returns an empty relation' do
|
it 'returns an empty relation' do
|
||||||
|
@ -1581,4 +1643,8 @@ describe Project, models: true do
|
||||||
expect(project.pushes_since_gc).to eq(0)
|
expect(project.pushes_since_gc).to eq(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def enable_lfs
|
||||||
|
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue