Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
51ea7adb
Commit
51ea7adb
authored
Jan 18, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print new project information in post receive
parent
e102be67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
5 deletions
+54
-5
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+1
-0
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+53
-5
No files found.
lib/gitlab_post_receive.rb
View file @
51ea7adb
...
...
@@ -27,6 +27,7 @@ class GitlabPostReceive
print_broadcast_message
(
response
[
'broadcast_message'
])
if
response
[
'broadcast_message'
]
print_merge_request_links
(
response
[
'merge_request_urls'
])
if
response
[
'merge_request_urls'
]
puts
response
[
'redirected_message'
]
if
response
[
'redirected_message'
]
puts
response
[
'project_created_message'
]
if
response
[
'project_created_message'
]
response
[
'reference_counter_decreased'
]
rescue
GitlabNet
::
ApiUnreachableError
...
...
spec/gitlab_post_receive_spec.rb
View file @
51ea7adb
...
...
@@ -63,7 +63,7 @@ describe GitlabPostReceive do
context
'when redirected message available'
do
let
(
:message
)
do
<<
-
MSG
<<
~
MSG
Project 'foo/bar' was moved to 'foo/baz'.
Please update your Git remote:
...
...
@@ -71,11 +71,12 @@ describe GitlabPostReceive do
git remote set-url origin http://localhost:3000/foo/baz.git
MSG
end
let
(
:response
)
do
{
{
'reference_counter_decreased'
=>
true
,
'redirected_message'
=>
message
}
}
end
it
'prints redirected message'
do
...
...
@@ -83,6 +84,37 @@ describe GitlabPostReceive do
assert_redirected_message_printed
(
gitlab_post_receive
)
expect
(
gitlab_post_receive
.
exec
).
to
eq
(
true
)
end
context
'when project created message is available'
do
let
(
:message
)
do
<<~
MSG
The private project foo/bar was successfully created.
To configure the remote, run:
git remote add origin http://localhost:3000/foo/bar.git
To view the project, visit:
http://localhost:3000/foo/bar
MSG
end
let
(
:response
)
do
{
'reference_counter_decreased'
=>
true
,
'project_created_message'
=>
message
}
end
it
'prints project created message'
do
expect_any_instance_of
(
GitlabNet
).
to
receive
(
:post_receive
).
and_return
(
response
)
assert_project_created_message_printed
(
gitlab_post_receive
)
expect
(
gitlab_post_receive
.
exec
).
to
be
true
end
end
end
end
...
...
@@ -129,9 +161,9 @@ describe GitlabPostReceive do
"========================================================================"
).
ordered
end
def
assert_redirected_message_printed
(
gitlab_post_receive
)
message
=
<<
-
MSG
message
=
<<
~
MSG
Project 'foo/bar' was moved to 'foo/baz'.
Please update your Git remote:
...
...
@@ -140,4 +172,20 @@ describe GitlabPostReceive do
MSG
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
message
).
ordered
end
def
assert_project_created_message_printed
(
gitlab_post_receive
)
message
=
<<~
MSG
The private project foo/bar was successfully created.
To configure the remote, run:
git remote add origin http://localhost:3000/foo/bar.git
To view the project, visit:
http://localhost:3000/foo/bar
MSG
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
message
).
ordered
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