Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9ab0af3b
Commit
9ab0af3b
authored
Oct 05, 2020
by
Gosia Ksionek
Committed by
Imre Farkas
Oct 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update groups factory and specs for consistency
parent
568940df
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
25 deletions
+18
-25
ee/spec/finders/ee/fork_targets_finder_spec.rb
ee/spec/finders/ee/fork_targets_finder_spec.rb
+1
-8
ee/spec/models/namespace_setting_spec.rb
ee/spec/models/namespace_setting_spec.rb
+11
-11
ee/spec/services/ee/namespace_settings/update_service_spec.rb
...pec/services/ee/namespace_settings/update_service_spec.rb
+0
-4
spec/factories/groups.rb
spec/factories/groups.rb
+2
-0
spec/services/namespace_settings/update_service_spec.rb
spec/services/namespace_settings/update_service_spec.rb
+4
-2
No files found.
ee/spec/finders/ee/fork_targets_finder_spec.rb
View file @
9ab0af3b
...
@@ -24,9 +24,6 @@ RSpec.describe ForkTargetsFinder do
...
@@ -24,9 +24,6 @@ RSpec.describe ForkTargetsFinder do
context
'when project root group prohibits outer forks'
do
context
'when project root group prohibits outer forks'
do
context
'when it is configured on saml level'
do
context
'when it is configured on saml level'
do
before
do
create
(
:namespace_settings
,
namespace:
project_group
,
prevent_forking_outside_group:
false
)
end
let
(
:project_group
)
do
let
(
:project_group
)
do
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
true
).
group
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
true
).
group
end
end
...
@@ -57,7 +54,7 @@ RSpec.describe ForkTargetsFinder do
...
@@ -57,7 +54,7 @@ RSpec.describe ForkTargetsFinder do
context
'when project root prohibits outer forks'
do
context
'when project root prohibits outer forks'
do
before
do
before
do
create
(
:namespace_settings
,
namespace:
project_group
,
prevent_forking_outside_group:
true
)
project_group
.
namespace_settings
.
update!
(
prevent_forking_outside_group:
true
)
end
end
it
'returns namespaces with the same root group as project one only'
do
it
'returns namespaces with the same root group as project one only'
do
...
@@ -67,10 +64,6 @@ RSpec.describe ForkTargetsFinder do
...
@@ -67,10 +64,6 @@ RSpec.describe ForkTargetsFinder do
end
end
context
'when project root does not prohibit outer forks'
do
context
'when project root does not prohibit outer forks'
do
before
do
create
(
:namespace_settings
,
namespace:
project_group
,
prevent_forking_outside_group:
false
)
end
it
'returns outer namespaces as well as inner'
do
it
'returns outer namespaces as well as inner'
do
expect
(
fork_targets
).
to
be_a
(
ActiveRecord
::
Relation
)
expect
(
fork_targets
).
to
be_a
(
ActiveRecord
::
Relation
)
expect
(
fork_targets
).
to
match_array
([
outer_group
,
inner_subgroup
,
user
.
namespace
])
expect
(
fork_targets
).
to
match_array
([
outer_group
,
inner_subgroup
,
user
.
namespace
])
...
...
ee/spec/models/namespace_setting_spec.rb
View file @
9ab0af3b
...
@@ -4,6 +4,7 @@ require 'spec_helper'
...
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec
.
describe
NamespaceSetting
do
RSpec
.
describe
NamespaceSetting
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:setting
)
{
group
.
namespace_settings
}
describe
'#prevent_forking_outside_group?'
do
describe
'#prevent_forking_outside_group?'
do
context
'with feature available'
do
context
'with feature available'
do
...
@@ -12,7 +13,9 @@ RSpec.describe NamespaceSetting do
...
@@ -12,7 +13,9 @@ RSpec.describe NamespaceSetting do
end
end
context
'group with no associated saml provider'
do
context
'group with no associated saml provider'
do
let
(
:setting
)
{
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
true
)
}
before
do
setting
.
update!
(
prevent_forking_outside_group:
true
)
end
it
'returns namespace setting'
do
it
'returns namespace setting'
do
expect
(
setting
.
prevent_forking_outside_group?
).
to
eq
(
true
)
expect
(
setting
.
prevent_forking_outside_group?
).
to
eq
(
true
)
...
@@ -25,9 +28,8 @@ RSpec.describe NamespaceSetting do
...
@@ -25,9 +28,8 @@ RSpec.describe NamespaceSetting do
end
end
context
'when it is configured to true on saml level'
do
context
'when it is configured to true on saml level'
do
let
(
:setting
)
{
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
true
)
}
before
do
before
do
setting
.
update!
(
prevent_forking_outside_group:
true
)
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
true
,
group:
group
)
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
true
,
group:
group
)
end
end
...
@@ -37,8 +39,6 @@ RSpec.describe NamespaceSetting do
...
@@ -37,8 +39,6 @@ RSpec.describe NamespaceSetting do
end
end
context
'when it is configured to false on saml level'
do
context
'when it is configured to false on saml level'
do
let
(
:setting
)
{
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
false
)
}
before
do
before
do
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
false
,
group:
group
)
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
false
,
group:
group
)
end
end
...
@@ -48,7 +48,9 @@ RSpec.describe NamespaceSetting do
...
@@ -48,7 +48,9 @@ RSpec.describe NamespaceSetting do
end
end
context
'when setting is configured on namespace level'
do
context
'when setting is configured on namespace level'
do
let
(
:setting
)
{
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
true
)
}
before
do
setting
.
update!
(
prevent_forking_outside_group:
true
)
end
it
'returns namespace setting'
do
it
'returns namespace setting'
do
expect
(
setting
.
prevent_forking_outside_group?
).
to
eq
(
true
)
expect
(
setting
.
prevent_forking_outside_group?
).
to
eq
(
true
)
...
@@ -59,7 +61,9 @@ RSpec.describe NamespaceSetting do
...
@@ -59,7 +61,9 @@ RSpec.describe NamespaceSetting do
end
end
context
'without feature available'
do
context
'without feature available'
do
let
(
:setting
)
{
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
true
)
}
before
do
setting
.
update!
(
prevent_forking_outside_group:
true
)
end
it
'returns false'
do
it
'returns false'
do
expect
(
setting
.
prevent_forking_outside_group?
).
to
be_falsey
expect
(
setting
.
prevent_forking_outside_group?
).
to
be_falsey
...
@@ -71,8 +75,6 @@ RSpec.describe NamespaceSetting do
...
@@ -71,8 +75,6 @@ RSpec.describe NamespaceSetting do
end
end
context
'when it is configured to true on saml level'
do
context
'when it is configured to true on saml level'
do
let
(
:setting
)
{
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
false
)
}
before
do
before
do
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
true
,
group:
group
)
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
true
,
group:
group
)
end
end
...
@@ -83,8 +85,6 @@ RSpec.describe NamespaceSetting do
...
@@ -83,8 +85,6 @@ RSpec.describe NamespaceSetting do
end
end
context
'when it is configured to false on saml level'
do
context
'when it is configured to false on saml level'
do
let
(
:setting
)
{
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
false
)
}
before
do
before
do
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
false
,
group:
group
)
create
(
:saml_provider
,
:enforced_group_managed_accounts
,
prohibited_outer_forks:
false
,
group:
group
)
end
end
...
...
ee/spec/services/ee/namespace_settings/update_service_spec.rb
View file @
9ab0af3b
...
@@ -9,10 +9,6 @@ RSpec.describe EE::NamespaceSettings::UpdateService do
...
@@ -9,10 +9,6 @@ RSpec.describe EE::NamespaceSettings::UpdateService do
subject
{
NamespaceSettings
::
UpdateService
.
new
(
user
,
group
,
params
).
execute
}
subject
{
NamespaceSettings
::
UpdateService
.
new
(
user
,
group
,
params
).
execute
}
describe
'#execute'
do
describe
'#execute'
do
before
do
create
(
:namespace_settings
,
namespace:
group
,
prevent_forking_outside_group:
false
)
end
context
'as a normal user'
do
context
'as a normal user'
do
let
(
:params
)
{
{
prevent_forking_outside_group:
true
}
}
let
(
:params
)
{
{
prevent_forking_outside_group:
true
}
}
...
...
spec/factories/groups.rb
View file @
9ab0af3b
...
@@ -14,6 +14,8 @@ FactoryBot.define do
...
@@ -14,6 +14,8 @@ FactoryBot.define do
# https://gitlab.com/gitlab-org/gitlab-foss/issues/43292
# https://gitlab.com/gitlab-org/gitlab-foss/issues/43292
raise
"Don't set owner for groups, use `group.add_owner(user)` instead"
raise
"Don't set owner for groups, use `group.add_owner(user)` instead"
end
end
create
(
:namespace_settings
,
namespace:
group
)
end
end
trait
:public
do
trait
:public
do
...
...
spec/services/namespace_settings/update_service_spec.rb
View file @
9ab0af3b
...
@@ -11,6 +11,10 @@ RSpec.describe NamespaceSettings::UpdateService do
...
@@ -11,6 +11,10 @@ RSpec.describe NamespaceSettings::UpdateService do
describe
"#execute"
do
describe
"#execute"
do
context
"group has no namespace_settings"
do
context
"group has no namespace_settings"
do
before
do
group
.
namespace_settings
.
destroy!
end
it
"builds out a new namespace_settings record"
do
it
"builds out a new namespace_settings record"
do
expect
do
expect
do
service
.
execute
service
.
execute
...
@@ -20,8 +24,6 @@ RSpec.describe NamespaceSettings::UpdateService do
...
@@ -20,8 +24,6 @@ RSpec.describe NamespaceSettings::UpdateService do
context
"group has a namespace_settings"
do
context
"group has a namespace_settings"
do
before
do
before
do
create
(
:namespace_settings
,
namespace:
group
)
service
.
execute
service
.
execute
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment