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
6a498b31
Commit
6a498b31
authored
Jun 03, 2021
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve some wiki specs
parent
b87f025a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
31 deletions
+30
-31
ee/spec/requests/api/wikis_spec.rb
ee/spec/requests/api/wikis_spec.rb
+5
-4
spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb
...res/projects/wiki/user_views_wiki_in_project_page_spec.rb
+2
-5
spec/requests/api/wikis_spec.rb
spec/requests/api/wikis_spec.rb
+23
-22
No files found.
ee/spec/requests/api/wikis_spec.rb
View file @
6a498b31
...
@@ -17,6 +17,7 @@ RSpec.describe API::Wikis do
...
@@ -17,6 +17,7 @@ RSpec.describe API::Wikis do
include
WorkhorseHelpers
include
WorkhorseHelpers
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:internal
,
:wiki_repo
)
}
let
(
:group
)
{
create
(
:group
,
:internal
,
:wiki_repo
)
}
let
(
:wiki
)
{
create
(
:group_wiki
,
container:
group
,
user:
user
)
}
let
(
:wiki
)
{
create
(
:group_wiki
,
container:
group
,
user:
user
)
}
let
(
:payload
)
{
{
content:
'content'
,
format:
'rdoc'
,
title:
'title'
}
}
let
(
:payload
)
{
{
content:
'content'
,
format:
'rdoc'
,
title:
'title'
}
}
...
@@ -474,8 +475,8 @@ RSpec.describe API::Wikis do
...
@@ -474,8 +475,8 @@ RSpec.describe API::Wikis do
end
end
context
'when user is owner of parent group'
do
context
'when user is owner of parent group'
do
let
(
:namespace
)
{
create
(
:group
).
tap
{
|
g
|
g
.
add_owner
(
user
)
}
}
let
_it_be
(
:namespace
)
{
create
(
:group
).
tap
{
|
g
|
g
.
add_owner
(
user
)
}
}
let
(
:group
)
{
create
(
:group
,
:wiki_repo
,
parent:
namespace
)
}
let
_it_be
(
:group
)
{
create
(
:group
,
:wiki_repo
,
parent:
namespace
)
}
include_examples
'wikis API updates wiki page'
include_examples
'wikis API updates wiki page'
end
end
...
@@ -589,8 +590,8 @@ RSpec.describe API::Wikis do
...
@@ -589,8 +590,8 @@ RSpec.describe API::Wikis do
end
end
context
'when user is owner of parent group'
do
context
'when user is owner of parent group'
do
let
(
:namespace
)
{
create
(
:group
).
tap
{
|
g
|
g
.
add_owner
(
user
)
}
}
let
_it_be
(
:namespace
)
{
create
(
:group
).
tap
{
|
g
|
g
.
add_owner
(
user
)
}
}
let
(
:group
)
{
create
(
:group
,
:wiki_repo
,
parent:
namespace
)
}
let
_it_be
(
:group
)
{
create
(
:group
,
:wiki_repo
,
parent:
namespace
)
}
before
do
before
do
delete
(
api
(
url
,
user
))
delete
(
api
(
url
,
user
))
...
...
spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb
View file @
6a498b31
...
@@ -3,15 +3,12 @@
...
@@ -3,15 +3,12 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects > Wiki > User views wiki in project page'
do
RSpec
.
describe
'Projects > Wiki > User views wiki in project page'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
project
.
add_maintainer
(
user
)
sign_in
(
project
.
owner
)
sign_in
(
user
)
end
end
context
'when repository is disabled for project'
do
context
'when repository is disabled for project'
do
let
(
:project
)
do
let
_it_be
(
:project
)
do
create
(
:project
,
create
(
:project
,
:wiki_repo
,
:wiki_repo
,
:repository_disabled
,
:repository_disabled
,
...
...
spec/requests/api/wikis_spec.rb
View file @
6a498b31
...
@@ -16,8 +16,19 @@ RSpec.describe API::Wikis do
...
@@ -16,8 +16,19 @@ RSpec.describe API::Wikis do
include
WorkhorseHelpers
include
WorkhorseHelpers
include
AfterNextHelpers
include
AfterNextHelpers
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
).
tap
{
|
g
|
g
.
add_owner
(
user
)
}
}
let_it_be
(
:group
)
{
create
(
:group
).
tap
{
|
g
|
g
.
add_owner
(
user
)
}
}
let_it_be
(
:group_project
)
{
create
(
:project
,
:wiki_repo
,
namespace:
group
)
}
let_it_be
(
:developer
)
{
create
(
:user
)
}
let_it_be
(
:maintainer
)
{
create
(
:user
)
}
let_it_be
(
:project_wiki_disabled
)
do
create
(
:project
,
:wiki_repo
,
:wiki_disabled
).
tap
do
|
project
|
project
.
add_developer
(
developer
)
project
.
add_maintainer
(
maintainer
)
end
end
let
(
:project_wiki
)
{
create
(
:project_wiki
,
project:
project
,
user:
user
)
}
let
(
:project_wiki
)
{
create
(
:project_wiki
,
project:
project
,
user:
user
)
}
let
(
:payload
)
{
{
content:
'content'
,
format:
'rdoc'
,
title:
'title'
}
}
let
(
:payload
)
{
{
content:
'content'
,
format:
'rdoc'
,
title:
'title'
}
}
let
(
:expected_keys_with_content
)
{
%w(content format slug title)
}
let
(
:expected_keys_with_content
)
{
%w(content format slug title)
}
...
@@ -32,7 +43,7 @@ RSpec.describe API::Wikis do
...
@@ -32,7 +43,7 @@ RSpec.describe API::Wikis do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis"
}
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis"
}
context
'when wiki is disabled'
do
context
'when wiki is disabled'
do
let
(
:project
)
{
create
(
:project
,
:wiki_repo
,
:wiki_disabled
)
}
let
(
:project
)
{
project_wiki_disabled
}
context
'when user is guest'
do
context
'when user is guest'
do
before
do
before
do
...
@@ -44,9 +55,7 @@ RSpec.describe API::Wikis do
...
@@ -44,9 +55,7 @@ RSpec.describe API::Wikis do
context
'when user is developer'
do
context
'when user is developer'
do
before
do
before
do
project
.
add_developer
(
user
)
get
api
(
url
,
developer
)
get
api
(
url
,
user
)
end
end
include_examples
'wiki API 403 Forbidden'
include_examples
'wiki API 403 Forbidden'
...
@@ -54,9 +63,7 @@ RSpec.describe API::Wikis do
...
@@ -54,9 +63,7 @@ RSpec.describe API::Wikis do
context
'when user is maintainer'
do
context
'when user is maintainer'
do
before
do
before
do
project
.
add_maintainer
(
user
)
get
api
(
url
,
maintainer
)
get
api
(
url
,
user
)
end
end
include_examples
'wiki API 403 Forbidden'
include_examples
'wiki API 403 Forbidden'
...
@@ -125,7 +132,7 @@ RSpec.describe API::Wikis do
...
@@ -125,7 +132,7 @@ RSpec.describe API::Wikis do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis/
#{
page
.
slug
}
"
}
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis/
#{
page
.
slug
}
"
}
context
'when wiki is disabled'
do
context
'when wiki is disabled'
do
let
(
:project
)
{
create
(
:project
,
:wiki_repo
,
:wiki_disabled
)
}
let
(
:project
)
{
project_wiki_disabled
}
context
'when user is guest'
do
context
'when user is guest'
do
before
do
before
do
...
@@ -137,9 +144,7 @@ RSpec.describe API::Wikis do
...
@@ -137,9 +144,7 @@ RSpec.describe API::Wikis do
context
'when user is developer'
do
context
'when user is developer'
do
before
do
before
do
project
.
add_developer
(
user
)
get
api
(
url
,
developer
)
get
api
(
url
,
user
)
end
end
include_examples
'wiki API 403 Forbidden'
include_examples
'wiki API 403 Forbidden'
...
@@ -147,9 +152,7 @@ RSpec.describe API::Wikis do
...
@@ -147,9 +152,7 @@ RSpec.describe API::Wikis do
context
'when user is maintainer'
do
context
'when user is maintainer'
do
before
do
before
do
project
.
add_maintainer
(
user
)
get
api
(
url
,
maintainer
)
get
api
(
url
,
user
)
end
end
include_examples
'wiki API 403 Forbidden'
include_examples
'wiki API 403 Forbidden'
...
@@ -249,7 +252,7 @@ RSpec.describe API::Wikis do
...
@@ -249,7 +252,7 @@ RSpec.describe API::Wikis do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis"
}
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis"
}
context
'when wiki is disabled'
do
context
'when wiki is disabled'
do
let
(
:project
)
{
create
(
:project
,
:wiki_disabled
,
:wiki_repo
)
}
let
(
:project
)
{
project_wiki_disabled
}
context
'when user is guest'
do
context
'when user is guest'
do
before
do
before
do
...
@@ -261,8 +264,7 @@ RSpec.describe API::Wikis do
...
@@ -261,8 +264,7 @@ RSpec.describe API::Wikis do
context
'when user is developer'
do
context
'when user is developer'
do
before
do
before
do
project
.
add_developer
(
user
)
post
(
api
(
url
,
developer
),
params:
payload
)
post
(
api
(
url
,
user
),
params:
payload
)
end
end
include_examples
'wiki API 403 Forbidden'
include_examples
'wiki API 403 Forbidden'
...
@@ -270,8 +272,7 @@ RSpec.describe API::Wikis do
...
@@ -270,8 +272,7 @@ RSpec.describe API::Wikis do
context
'when user is maintainer'
do
context
'when user is maintainer'
do
before
do
before
do
project
.
add_maintainer
(
user
)
post
(
api
(
url
,
maintainer
),
params:
payload
)
post
(
api
(
url
,
user
),
params:
payload
)
end
end
include_examples
'wiki API 403 Forbidden'
include_examples
'wiki API 403 Forbidden'
...
@@ -469,7 +470,7 @@ RSpec.describe API::Wikis do
...
@@ -469,7 +470,7 @@ RSpec.describe API::Wikis do
end
end
context
'when wiki belongs to a group project'
do
context
'when wiki belongs to a group project'
do
let
(
:project
)
{
create
(
:project
,
:wiki_repo
,
namespace:
group
)
}
let
(
:project
)
{
group_project
}
include_examples
'wikis API updates wiki page'
include_examples
'wikis API updates wiki page'
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