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
867ac4d1
Commit
867ac4d1
authored
Apr 02, 2019
by
Luke Duncalfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change double quote strings to single quotes
parent
aa352a95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+19
-19
No files found.
spec/requests/api/internal_spec.rb
View file @
867ac4d1
...
...
@@ -907,7 +907,7 @@ describe API::Internal do
expect
(
PostReceive
).
to
receive
(
:perform_async
)
.
with
(
gl_repository
,
identifier
,
changes
,
push_options
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
end
it
'decreases the reference counter and returns the result'
do
...
...
@@ -915,13 +915,13 @@ describe API::Internal do
.
and_return
(
reference_counter
)
expect
(
reference_counter
).
to
receive
(
:decrease
).
and_return
(
true
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
json_response
[
'reference_counter_decreased'
]).
to
be
(
true
)
end
it
'returns link to create new merge request'
do
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
json_response
[
'merge_request_urls'
]).
to
match
[{
"branch_name"
=>
"new_branch"
,
...
...
@@ -933,7 +933,7 @@ describe API::Internal do
it
'returns empty array if printing_merge_request_link_enabled is false'
do
project
.
update!
(
printing_merge_request_link_enabled:
false
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
json_response
[
'merge_request_urls'
]).
to
eq
([])
end
...
...
@@ -941,7 +941,7 @@ describe API::Internal do
it
'does not invoke MergeRequests::PushOptionsHandlerService'
do
expect
(
MergeRequests
::
PushOptionsHandlerService
).
not_to
receive
(
:new
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
end
context
'when there are merge_request push options'
do
...
...
@@ -952,16 +952,16 @@ describe API::Internal do
it
'invokes MergeRequests::PushOptionsHandlerService'
do
expect
(
MergeRequests
::
PushOptionsHandlerService
).
to
receive
(
:new
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
end
it
'links to the newly created merge request'
do
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
json_response
[
'merge_request_urls'
]).
to
match
[{
"branch_name"
=>
"new_branch"
,
"url"
=>
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
/
#{
project
.
namespace
.
name
}
/
#{
project
.
path
}
/merge_requests/1"
,
"new_merge_request"
=>
false
'branch_name'
=>
'new_branch'
,
'url'
=>
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
/
#{
project
.
namespace
.
name
}
/
#{
project
.
path
}
/merge_requests/1"
,
'new_merge_request'
=>
false
}]
end
...
...
@@ -970,7 +970,7 @@ describe API::Internal do
MergeRequests
::
PushOptionsHandlerService
::
Error
,
'my warning'
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
json_response
[
'warnings'
]).
to
eq
(
'Error encountered with push options \'merge_request.create\': my warning'
)
end
...
...
@@ -980,7 +980,7 @@ describe API::Internal do
MergeRequests
::
PushOptionsHandlerService
).
to
receive
(
:errors
).
at_least
(
:once
).
and_return
([
'my error'
])
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
json_response
[
'warnings'
]).
to
eq
(
'Error encountered with push options \'merge_request.create\': my error'
)
end
...
...
@@ -993,7 +993,7 @@ describe API::Internal do
MergeRequests
::
CreateService
).
to
receive
(
:execute
).
and_return
(
invalid_merge_request
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
json_response
[
'warnings'
]).
to
eq
(
'Error encountered with push options \'merge_request.create\': my error'
)
end
...
...
@@ -1003,7 +1003,7 @@ describe API::Internal do
let!
(
:broadcast_message
)
{
create
(
:broadcast_message
,
starts_at:
1
.
day
.
ago
,
ends_at:
1
.
day
.
from_now
)
}
it
'returns one broadcast message'
do
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'broadcast_message'
]).
to
eq
(
broadcast_message
.
message
)
...
...
@@ -1012,7 +1012,7 @@ describe API::Internal do
context
'broadcast message does not exist'
do
it
'returns empty string'
do
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'broadcast_message'
]).
to
eq
(
nil
)
...
...
@@ -1023,7 +1023,7 @@ describe API::Internal do
it
'returns empty string'
do
allow
(
BroadcastMessage
).
to
receive
(
:current
).
and_return
(
nil
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'broadcast_message'
]).
to
eq
(
nil
)
...
...
@@ -1035,7 +1035,7 @@ describe API::Internal do
project_moved
=
Gitlab
::
Checks
::
ProjectMoved
.
new
(
project
,
user
,
'http'
,
'foo/baz'
)
project_moved
.
add_message
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
"redirected_message"
]).
to
be_present
...
...
@@ -1048,7 +1048,7 @@ describe API::Internal do
project_created
=
Gitlab
::
Checks
::
ProjectCreated
.
new
(
project
,
user
,
'http'
)
project_created
.
add_message
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
"project_created_message"
]).
to
be_present
...
...
@@ -1060,7 +1060,7 @@ describe API::Internal do
it
'does not try to notify that project moved'
do
allow_any_instance_of
(
Gitlab
::
Identifier
).
to
receive
(
:identify
).
and_return
(
nil
)
post
api
(
"/internal/post_receive"
),
params:
valid_params
post
api
(
'/internal/post_receive'
),
params:
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
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