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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
17c92631
Commit
17c92631
authored
Jun 01, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for Project#protected_for?
parent
554426dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+37
-0
No files found.
spec/models/project_spec.rb
View file @
17c92631
...
...
@@ -1796,6 +1796,43 @@ describe Project, models: true do
end
end
describe
'#protected_for?'
do
let
(
:project
)
{
create
(
:empty_project
)
}
subject
{
project
.
protected_for?
(
'ref'
)
}
context
'when the ref is not protected'
do
before
do
stub_application_setting
(
default_branch_protection:
Gitlab
::
Access
::
PROTECTION_NONE
)
end
it
'returns false'
do
is_expected
.
to
be_falsey
end
end
context
'when the ref is a protected branch'
do
before
do
create
(
:protected_branch
,
name:
'ref'
,
project:
project
)
end
it
'returns true'
do
is_expected
.
to
be_truthy
end
end
context
'when the ref is a protected tag'
do
before
do
create
(
:protected_tag
,
name:
'ref'
,
project:
project
)
end
it
'returns true'
do
is_expected
.
to
be_truthy
end
end
end
describe
'#update_project_statistics'
do
let
(
:project
)
{
create
(
:empty_project
)
}
...
...
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