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
8a318984
Commit
8a318984
authored
Dec 09, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few more specs
parent
90719161
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
spec/services/geo/schedule_repository_create_service_spec.rb
spec/services/geo/schedule_repository_create_service_spec.rb
+16
-0
spec/workers/geo_repository_create_worker_spec.rb
spec/workers/geo_repository_create_worker_spec.rb
+13
-4
No files found.
spec/services/geo/schedule_repository_create_service_spec.rb
0 → 100644
View file @
8a318984
require
'spec_helper'
describe
Geo
::
ScheduleRepoCreateService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
subject
{
described_class
.
new
(
project_id:
project
.
id
)
}
describe
'#execute'
do
it
'schedules the repository creation'
do
Sidekiq
::
Worker
.
clear_all
Sidekiq
::
Testing
.
fake!
do
expect
{
subject
.
execute
}.
to
change
(
GeoRepositoryCreateWorker
.
jobs
,
:size
).
by
(
1
)
end
end
end
end
spec/workers/geo_repository_create_worker_spec.rb
View file @
8a318984
...
...
@@ -5,11 +5,10 @@ describe GeoRepositoryCreateWorker do
let
(
:project
)
{
create
:project
}
let
(
:perform!
)
{
subject
.
perform
(
project
.
id
)
}
before
{
expect
(
Project
).
to
receive
(
:find
).
at_least
(
:once
).
with
(
project
.
id
)
{
project
}
}
context
'when no repository'
do
before
do
expect
(
Project
).
to
receive
(
:find
).
at_least
(
:once
).
with
(
project
.
id
)
{
project
}
expect
(
project
).
to
receive
(
:repository_exists?
)
{
false
}
end
before
{
expect
(
project
).
to
receive
(
:repository_exists?
)
{
false
}
}
it
'creates the repository'
do
expect
(
project
).
to
receive
(
:create_repository
)
...
...
@@ -17,4 +16,14 @@ describe GeoRepositoryCreateWorker do
perform!
end
end
context
'when repository exists'
do
before
{
expect
(
project
).
to
receive
(
:repository_exists?
)
{
true
}
}
it
'does not try to create the repository again'
do
expect
(
project
).
not_to
receive
(
:create_repository
)
perform!
end
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