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
1
Merge Requests
1
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-ce
Commits
fd1723f0
Commit
fd1723f0
authored
Jun 03, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for project destroy service
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
97ff86e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+34
-0
No files found.
spec/services/projects/destroy_service_spec.rb
0 → 100644
View file @
fd1723f0
require
'spec_helper'
describe
Projects
::
DestroyService
do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:path
)
{
project
.
repository
.
path_to_repo
}
let!
(
:remove_path
)
{
path
.
sub
(
/\.git\Z/
,
"+
#{
project
.
id
}
+deleted.git"
)
}
context
'Sidekiq inline'
do
before
do
# Run sidekiq immediatly to check that renamed repository will be removed
Sidekiq
::
Testing
.
inline!
{
destroy_project
(
project
,
user
,
{})
}
end
it
{
Project
.
all
.
should_not
include
(
project
)
}
it
{
Dir
.
exists?
(
path
).
should
be_falsey
}
it
{
Dir
.
exists?
(
remove_path
).
should
be_falsey
}
end
context
'Sidekiq fake'
do
before
do
# Dont run sidekiq to check if renamed repository exists
Sidekiq
::
Testing
.
fake!
{
destroy_project
(
project
,
user
,
{})
}
end
it
{
Project
.
all
.
should_not
include
(
project
)
}
it
{
Dir
.
exists?
(
path
).
should
be_falsey
}
it
{
Dir
.
exists?
(
remove_path
).
should
be_truthy
}
end
def
destroy_project
(
project
,
user
,
params
)
Projects
::
DestroyService
.
new
(
project
,
user
,
params
).
execute
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