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
Boxiang Sun
gitlab-ce
Commits
5a38a9d8
Commit
5a38a9d8
authored
Nov 09, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec examples for Gitlab::Gitaly::WikiService
parent
f24a78f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
spec/lib/gitlab/gitaly_client/wiki_service_spec.rb
spec/lib/gitlab/gitaly_client/wiki_service_spec.rb
+44
-0
No files found.
spec/lib/gitlab/gitaly_client/wiki_service_spec.rb
0 → 100644
View file @
5a38a9d8
require
'spec_helper'
describe
Gitlab
::
GitalyClient
::
WikiService
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:storage_name
)
{
project
.
repository_storage
}
let
(
:relative_path
)
{
project
.
disk_path
+
'.git'
}
let
(
:client
)
{
described_class
.
new
(
project
.
repository
)
}
let
(
:commit
)
{
create
(
:gitaly_commit
)
}
let
(
:page_version
)
{
Gitaly
::
WikiPageVersion
.
new
(
format:
'markdown'
,
commit:
commit
)
}
let
(
:page_info
)
{
{
title:
'My Page'
,
raw_data:
'a'
,
version:
page_version
}
}
describe
'#find_page'
do
let
(
:response
)
do
[
Gitaly
::
WikiFindPageResponse
.
new
(
page:
Gitaly
::
WikiPage
.
new
(
page_info
)),
Gitaly
::
WikiFindPageResponse
.
new
(
page:
Gitaly
::
WikiPage
.
new
(
raw_data:
'b'
))
]
end
let
(
:wiki_page
)
{
subject
.
first
}
let
(
:wiki_page_version
)
{
subject
.
last
}
subject
{
client
.
find_page
(
title:
'My Page'
,
version:
'master'
,
dir:
''
)
}
it
'sends a wiki_find_page message'
do
expect_any_instance_of
(
Gitaly
::
WikiService
::
Stub
)
.
to
receive
(
:wiki_find_page
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
([].
each
)
subject
end
it
'concatenates the raw data and returns a pair of WikiPage and WikiPageVersion'
do
expect_any_instance_of
(
Gitaly
::
WikiService
::
Stub
)
.
to
receive
(
:wiki_find_page
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
(
response
.
each
)
expect
(
wiki_page
.
title
).
to
eq
(
'My Page'
)
expect
(
wiki_page
.
raw_data
).
to
eq
(
'ab'
)
expect
(
wiki_page_version
.
format
).
to
eq
(
'markdown'
)
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