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
86e098ac
Commit
86e098ac
authored
Aug 19, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't have factories trip a validation
parent
8eef877c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
app/models/concerns/protected_branch_access.rb
app/models/concerns/protected_branch_access.rb
+2
-2
spec/factories/protected_branches/merge_access_levels.rb
spec/factories/protected_branches/merge_access_levels.rb
+1
-1
spec/factories/protected_branches/push_access_levels.rb
spec/factories/protected_branches/push_access_levels.rb
+1
-1
No files found.
app/models/concerns/protected_branch_access.rb
View file @
86e098ac
...
...
@@ -2,8 +2,8 @@ module ProtectedBranchAccess
extend
ActiveSupport
::
Concern
included
do
validates
_uniqueness_of
:user_id
,
scope: :protected_branch
,
allow_nil:
true
validates
_uniqueness_of
:access_level
,
scope: :protected_branch
,
unless: :user_id?
,
conditions:
->
{
where
(
user_id:
nil
)
}
validates
:user_id
,
uniqueness:
{
scope: :protected_branch
,
allow_nil:
true
}
validates
:access_level
,
uniqueness:
{
scope: :protected_branch
,
unless: :user_id?
,
conditions:
->
{
where
(
user_id:
nil
)
}
}
end
def
type
...
...
spec/factories/protected_branches/merge_access_levels.rb
View file @
86e098ac
...
...
@@ -2,6 +2,6 @@ FactoryGirl.define do
factory
:protected_branch_merge_access_level
,
class:
ProtectedBranch
::
MergeAccessLevel
do
user
nil
protected_branch
access_level
{
Gitlab
::
Access
::
MAST
ER
}
access_level
{
Gitlab
::
Access
::
DEVELOP
ER
}
end
end
spec/factories/protected_branches/push_access_levels.rb
View file @
86e098ac
...
...
@@ -2,6 +2,6 @@ FactoryGirl.define do
factory
:protected_branch_push_access_level
,
class:
ProtectedBranch
::
PushAccessLevel
do
user
nil
protected_branch
access_level
{
Gitlab
::
Access
::
MAST
ER
}
access_level
{
Gitlab
::
Access
::
DEVELOP
ER
}
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