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
Jérome Perrin
gitlab-ce
Commits
8a08fdcd
Commit
8a08fdcd
authored
Dec 09, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix worker specs to parse namespaces
parent
80e984ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
app/workers/post_receive.rb
app/workers/post_receive.rb
+3
-2
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+8
-4
No files found.
app/workers/post_receive.rb
View file @
8a08fdcd
...
...
@@ -2,8 +2,9 @@ class PostReceive
@queue
=
:post_receive
def
self
.
perform
(
repo_path
,
oldrev
,
newrev
,
ref
,
identifier
)
repo_path
=
repo_path
.
gsub
(
Gitlab
.
config
.
git_base_path
,
""
)
repo_path
=
repo_path
.
gsub
(
/.git$/
,
""
)
repo_path
.
gsub!
(
Gitlab
.
config
.
git_base_path
.
to_s
,
""
)
repo_path
.
gsub!
(
/.git$/
,
""
)
repo_path
.
gsub!
(
/^\//
,
""
)
project
=
Project
.
find_with_namespace
(
repo_path
)
return
false
if
project
.
nil?
...
...
spec/workers/post_receive_spec.rb
View file @
8a08fdcd
...
...
@@ -14,8 +14,8 @@ describe PostReceive do
let
(
:key_id
)
{
key
.
identifier
}
it
"fetches the correct project"
do
Project
.
should_receive
(
:find_by_path
).
with
(
project
.
path
).
and_return
(
project
)
PostReceive
.
perform
(
p
roject
.
path
,
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
Project
.
should_receive
(
:find_by_path
).
with
(
project
.
path
_with_namespace
).
and_return
(
project
)
PostReceive
.
perform
(
p
wd
(
project
)
,
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
end
it
"does not run if the author is not in the project"
do
...
...
@@ -24,7 +24,7 @@ describe PostReceive do
project
.
should_not_receive
(
:observe_push
)
project
.
should_not_receive
(
:execute_hooks
)
PostReceive
.
perform
(
p
roject
.
path
,
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
).
should
be_false
PostReceive
.
perform
(
p
wd
(
project
)
,
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
).
should
be_false
end
it
"asks the project to trigger all hooks"
do
...
...
@@ -34,7 +34,11 @@ describe PostReceive do
project
.
should_receive
(
:update_merge_requests
)
project
.
should_receive
(
:observe_push
)
PostReceive
.
perform
(
p
roject
.
path
,
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
PostReceive
.
perform
(
p
wd
(
project
)
,
'sha-old'
,
'sha-new'
,
'refs/heads/master'
,
key_id
)
end
end
def
pwd
(
project
)
File
.
join
(
Gitlab
.
config
.
git_base_path
,
project
.
path_with_namespace
)
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