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
d40912bb
Commit
d40912bb
authored
Feb 07, 2018
by
Francisco Javier López
Committed by
Sean McGivern
Feb 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing gitaly flags
parent
683984f2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
406 additions
and
368 deletions
+406
-368
lib/gitlab/git/wiki.rb
lib/gitlab/git/wiki.rb
+2
-4
spec/features/projects/wiki/user_updates_wiki_page_spec.rb
spec/features/projects/wiki/user_updates_wiki_page_spec.rb
+156
-148
spec/features/projects/wiki/user_views_wiki_page_spec.rb
spec/features/projects/wiki/user_views_wiki_page_spec.rb
+107
-98
spec/lib/gitlab/git/wiki_spec.rb
spec/lib/gitlab/git/wiki_spec.rb
+17
-13
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+124
-105
No files found.
lib/gitlab/git/wiki.rb
View file @
d40912bb
...
...
@@ -25,9 +25,8 @@ module Gitlab
@repository
.
exists?
end
# Disabled because of https://gitlab.com/gitlab-org/gitaly/merge_requests/539
def
write_page
(
name
,
format
,
content
,
commit_details
)
@repository
.
gitaly_migrate
(
:wiki_write_page
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
DISABLED
)
do
|
is_enabled
|
@repository
.
gitaly_migrate
(
:wiki_write_page
)
do
|
is_enabled
|
if
is_enabled
gitaly_write_page
(
name
,
format
,
content
,
commit_details
)
gollum_wiki
.
clear_cache
...
...
@@ -48,9 +47,8 @@ module Gitlab
end
end
# Disable because of https://gitlab.com/gitlab-org/gitlab-ce/issues/42094
def
update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
@repository
.
gitaly_migrate
(
:wiki_update_page
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
DISABLED
)
do
|
is_enabled
|
@repository
.
gitaly_migrate
(
:wiki_update_page
)
do
|
is_enabled
|
if
is_enabled
gitaly_update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
gollum_wiki
.
clear_cache
...
...
spec/features/projects/wiki/user_updates_wiki_page_spec.rb
View file @
d40912bb
require
'spec_helper'
# Remove skip_gitaly_mock flag when gitaly_update_page implements moving pages
describe
'User updates wiki page'
,
:skip_gitaly_mock
do
describe
'User updates wiki page'
do
shared_examples
'wiki page user update'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
...
...
@@ -165,7 +164,7 @@ describe 'User updates wiki page', :skip_gitaly_mock do
visit
(
project_wiki_edit_path
(
project
,
wiki_page
))
end
it
'moves the page to the root folder'
do
it
'moves the page to the root folder'
,
:skip_gitaly_mock
do
fill_in
(
:wiki_title
,
with:
"/
#{
page_name
}
"
)
click_button
(
'Save changes'
)
...
...
@@ -223,4 +222,13 @@ describe 'User updates wiki page', :skip_gitaly_mock do
expect
(
current_path
).
to
eq
(
project_wiki_path
(
project
,
"foo1/bar1/
#{
page_name
}
"
))
end
end
end
context
'when Gitaly is enabled'
do
it_behaves_like
'wiki page user update'
end
context
'when Gitaly is disabled'
,
:skip_gitaly_mock
do
it_behaves_like
'wiki page user update'
end
end
spec/features/projects/wiki/user_views_wiki_page_spec.rb
View file @
d40912bb
require
'spec_helper'
# Remove skip_gitaly_mock flag when gitaly_update_page implements moving pages
describe
'User views a wiki page'
,
:skip_gitaly_mock
do
describe
'User views a wiki page'
do
shared_examples
'wiki page user view'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:wiki_page
)
do
...
...
@@ -143,4 +143,13 @@ describe 'User views a wiki page', :skip_gitaly_mock do
expect
(
page
).
to
have_content
(
'Home · Create Page'
)
end
end
context
'when Gitaly is enabled'
do
it_behaves_like
'wiki page user view'
end
context
'when Gitaly is disabled'
,
:skip_gitaly_mock
do
it_behaves_like
'wiki page user view'
end
end
spec/lib/gitlab/git/wiki_spec.rb
View file @
d40912bb
...
...
@@ -3,34 +3,38 @@ require 'spec_helper'
describe
Gitlab
::
Git
::
Wiki
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:wiki
)
{
ProjectWiki
.
new
(
project
,
user
)
}
let
(
:gollum_wiki
)
{
wiki
.
wiki
}
let
(
:
project_
wiki
)
{
ProjectWiki
.
new
(
project
,
user
)
}
subject
{
project_
wiki
.
wiki
}
# Remove skip_gitaly_mock flag when gitaly_find_page when
# https://gitlab.com/gitlab-org/git
aly/merge_requests/539 gets merg
ed
# https://gitlab.com/gitlab-org/git
lab-ce/issues/42039 is solv
ed
describe
'#page'
,
:skip_gitaly_mock
do
it
'returns the right page'
do
before
do
create_page
(
'page1'
,
'content'
)
create_page
(
'foo/page1'
,
'content'
)
expect
(
gollum_wiki
.
page
(
title:
'page1'
,
dir:
''
).
url_path
).
to
eq
'page1'
expect
(
gollum_wiki
.
page
(
title:
'page1'
,
dir:
'foo'
).
url_path
).
to
eq
'foo/page1'
create_page
(
'foo/page1'
,
'content foo/page1'
)
end
after
do
destroy_page
(
'page1'
)
destroy_page
(
'page1'
,
'foo'
)
end
it
'returns the right page'
do
expect
(
subject
.
page
(
title:
'page1'
,
dir:
''
).
url_path
).
to
eq
'page1'
expect
(
subject
.
page
(
title:
'page1'
,
dir:
'foo'
).
url_path
).
to
eq
'foo/page1'
end
end
def
create_page
(
name
,
content
)
gollum_wiki
.
write_page
(
name
,
:markdown
,
content
,
commit_details
)
subject
.
write_page
(
name
,
:markdown
,
content
,
commit_details
(
name
)
)
end
def
commit_details
Gitlab
::
Git
::
Wiki
::
CommitDetails
.
new
(
user
.
name
,
user
.
email
,
"
test commit
"
)
def
commit_details
(
name
)
Gitlab
::
Git
::
Wiki
::
CommitDetails
.
new
(
user
.
name
,
user
.
email
,
"
created page
#{
name
}
"
)
end
def
destroy_page
(
title
,
dir
=
''
)
page
=
gollum_wiki
.
page
(
title:
title
,
dir:
dir
)
wiki
.
delete_page
(
page
,
"test commit"
)
page
=
subject
.
page
(
title:
title
,
dir:
dir
)
project_
wiki
.
delete_page
(
page
,
"test commit"
)
end
end
spec/models/wiki_page_spec.rb
View file @
d40912bb
...
...
@@ -188,7 +188,8 @@ describe WikiPage do
end
end
describe
'#create'
,
:skip_gitaly_mock
do
describe
'#create'
do
shared_examples
'create method'
do
context
'with valid attributes'
do
it
'raises an error if a page with the same path already exists'
do
create_page
(
'New Page'
,
'content'
)
...
...
@@ -210,8 +211,17 @@ describe WikiPage do
end
end
# Remove skip_gitaly_mock flag when gitaly_update_page implements moving pages
describe
"#update"
,
:skip_gitaly_mock
do
context
'when Gitaly is enabled'
do
it_behaves_like
'create method'
end
context
'when Gitaly is disabled'
,
:skip_gitaly_mock
do
it_behaves_like
'create method'
end
end
describe
"#update"
do
shared_examples
'update method'
do
before
do
create_page
(
"Update"
,
"content"
)
@page
=
wiki
.
find_page
(
"Update"
)
...
...
@@ -310,7 +320,7 @@ describe WikiPage do
@page
=
wiki
.
find_page
(
'foo/Existing Page'
)
end
it
'moves the page to the root folder if the title is preceded by /'
do
it
'moves the page to the root folder if the title is preceded by /'
,
:skip_gitaly_mock
do
expect
(
@page
.
slug
).
to
eq
'foo/Existing-Page'
expect
(
@page
.
update
(
title:
'/Existing Page'
,
content:
'new_content'
)).
to
be_truthy
expect
(
@page
.
slug
).
to
eq
'Existing-Page'
...
...
@@ -347,6 +357,15 @@ describe WikiPage do
end
end
context
'when Gitaly is enabled'
do
it_behaves_like
'update method'
end
context
'when Gitaly is disabled'
,
:skip_gitaly_mock
do
it_behaves_like
'update method'
end
end
describe
"#destroy"
do
before
do
create_page
(
"Delete Page"
,
"content"
)
...
...
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