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
6e4d67e0
Commit
6e4d67e0
authored
Apr 10, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix hook data specs
parent
95265c08
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
11 deletions
+12
-11
spec/lib/gitlab/hook_data/issue_builder_spec.rb
spec/lib/gitlab/hook_data/issue_builder_spec.rb
+1
-1
spec/lib/gitlab/hook_data/merge_request_builder_spec.rb
spec/lib/gitlab/hook_data/merge_request_builder_spec.rb
+9
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+0
-8
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+2
-2
No files found.
spec/lib/gitlab/hook_data/issue_builder_spec.rb
View file @
6e4d67e0
...
...
@@ -45,7 +45,7 @@ describe Gitlab::HookData::IssueBuilder do
let
(
:issue_with_description
)
{
create
(
:issue
,
description:
'test![Issue_Image](/uploads/abc/Issue_Image.png)'
)
}
let
(
:builder
)
{
described_class
.
new
(
issue_with_description
)
}
it
'
adds absolute urls for images in the description
'
do
it
'
sets the image to use an absolute URL
'
do
expect
(
data
[
:description
]).
to
eq
(
"test![Issue_Image](
#{
Settings
.
gitlab
.
url
}
/uploads/abc/Issue_Image.png)"
)
end
end
...
...
spec/lib/gitlab/hook_data/merge_request_builder_spec.rb
View file @
6e4d67e0
...
...
@@ -56,5 +56,14 @@ describe Gitlab::HookData::MergeRequestBuilder do
expect
(
data
).
to
include
(
:human_time_estimate
)
expect
(
data
).
to
include
(
:human_total_time_spent
)
end
context
'when the MR has an image in the description'
do
let
(
:mr_with_description
)
{
create
(
:merge_request
,
description:
'test![Issue_Image](/uploads/abc/Issue_Image.png)'
)
}
let
(
:builder
)
{
described_class
.
new
(
mr_with_description
)
}
it
'sets the image to use an absolute URL'
do
expect
(
data
[
:description
]).
to
eq
(
"test![Issue_Image](
#{
Settings
.
gitlab
.
url
}
/uploads/abc/Issue_Image.png)"
)
end
end
end
end
spec/models/merge_request_spec.rb
View file @
6e4d67e0
...
...
@@ -2357,12 +2357,4 @@ describe MergeRequest do
end
end
end
describe
'#hook_attrs'
do
let
(
:mr_with_description
)
{
create
(
:merge_request
,
description:
'test![Mr_Image](/uploads/abc/Mr_Image.png)'
)
}
it
'adds absolute urls for images in the description'
do
expect
(
mr_with_description
.
hook_attrs
[
'description'
]).
to
eq
(
"test![Mr_Image](
#{
Settings
.
gitlab
.
url
}
/uploads/abc/Mr_Image.png)"
)
end
end
end
spec/models/wiki_page_spec.rb
View file @
6e4d67e0
...
...
@@ -557,8 +557,8 @@ describe WikiPage do
describe
'#hook_attrs'
do
before
do
create_page
(
"test page"
,
"test![WikiPage_Image](/uploads/abc/WikiPage_Image.png)"
)
@page
=
wiki
.
wiki
.
page
d
(
"test page"
)
@wiki_page
=
WikiPage
.
new
(
wiki
,
@page
,
true
)
@page
=
wiki
.
wiki
.
page
(
title:
"test page"
)
@wiki_page
=
described_class
.
new
(
wiki
,
@page
,
true
)
end
it
'adds absolute urls for images in the content'
do
...
...
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