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
5374f423
Commit
5374f423
authored
Sep 11, 2019
by
Krasimir Angelov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for ProjectFeature's #public_pages? and #private_pages?
parent
91af0cf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
spec/models/project_feature_spec.rb
spec/models/project_feature_spec.rb
+54
-0
No files found.
spec/models/project_feature_spec.rb
View file @
5374f423
...
...
@@ -174,4 +174,58 @@ describe ProjectFeature do
it
{
is_expected
.
to
eq
(
ProjectFeature
::
ENABLED
)
}
end
end
describe
'#public_pages?'
do
it
'returns true if Pages access controll is not enabled'
do
stub_config
(
pages:
{
access_control:
false
})
project_feature
=
described_class
.
new
expect
(
project_feature
.
public_pages?
).
to
eq
(
true
)
end
context
'Pages access control is enabled'
do
before
do
stub_config
(
pages:
{
access_control:
true
})
end
it
'returns true if Pages access level is public'
do
project_feature
=
described_class
.
new
(
pages_access_level:
described_class
::
PUBLIC
)
expect
(
project_feature
.
public_pages?
).
to
eq
(
true
)
end
it
'returns true if Pages access level is enabled and the project is public'
do
project
=
build
(
:project
,
:public
)
project_feature
=
described_class
.
new
(
project:
project
,
pages_access_level:
described_class
::
ENABLED
)
expect
(
project_feature
.
public_pages?
).
to
eq
(
true
)
end
it
'returns false if pages or the project are not public'
do
project
=
build
(
:project
,
:private
)
project_feature
=
described_class
.
new
(
project:
project
,
pages_access_level:
described_class
::
ENABLED
)
expect
(
project_feature
.
public_pages?
).
to
eq
(
false
)
end
end
describe
'#private_pages?'
do
subject
(
:project_feature
)
{
described_class
.
new
}
it
'returns false if public_pages? is true'
do
expect
(
project_feature
).
to
receive
(
:public_pages?
).
and_return
(
true
)
expect
(
project_feature
.
private_pages?
).
to
eq
(
false
)
end
it
'returns true if public_pages? is false'
do
expect
(
project_feature
).
to
receive
(
:public_pages?
).
and_return
(
false
)
expect
(
project_feature
.
private_pages?
).
to
eq
(
true
)
end
end
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