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
aa06b60e
Commit
aa06b60e
authored
Aug 03, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve spec for Geo::FileDownloadDispatchWorker
parent
ab4a98ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
spec/workers/geo/file_download_dispatch_worker_spec.rb
spec/workers/geo/file_download_dispatch_worker_spec.rb
+16
-12
No files found.
spec/workers/geo/file_download_dispatch_worker_spec.rb
View file @
aa06b60e
...
@@ -76,35 +76,39 @@ describe Geo::FileDownloadDispatchWorker do
...
@@ -76,35 +76,39 @@ describe Geo::FileDownloadDispatchWorker do
end
end
context
'when node has namespace restrictions'
do
context
'when node has namespace restrictions'
do
let
(
:
group_1
)
{
create
(
:group
)
}
let
(
:
synced_group
)
{
create
(
:group
)
}
let!
(
:project_
1
)
{
create
(
:project
,
group:
group_1
)
}
let!
(
:project_
in_synced_group
)
{
create
(
:project
,
group:
synced_group
)
}
let!
(
:
project_2
)
{
create
(
:project
)
}
let!
(
:
unsynced_project
)
{
create
(
:project
)
}
before
do
before
do
allow
(
ProjectCacheWorker
).
to
receive
(
:perform_async
).
and_return
(
true
)
allow
(
ProjectCacheWorker
).
to
receive
(
:perform_async
).
and_return
(
true
)
allow_any_instance_of
(
described_class
).
to
receive
(
:over_time?
).
and_return
(
false
)
allow_any_instance_of
(
described_class
).
to
receive
(
:over_time?
).
and_return
(
false
)
secondary
.
update_attribute
(
:namespaces
,
[
group_1
])
secondary
.
update_attribute
(
:namespaces
,
[
synced_group
])
end
end
it
'does not perform GeoFileDownloadWorker for LFS object that does not belong to selected namespaces to replicate'
do
it
'does not perform GeoFileDownloadWorker for LFS object that does not belong to selected namespaces to replicate'
do
create
(
:lfs_objects_project
,
project:
project_1
)
lfs_objec_in_synced_group
=
create
(
:lfs_objects_project
,
project:
project_in_synced_group
)
create
(
:lfs_objects_project
,
project:
project_2
)
create
(
:lfs_objects_project
,
project:
unsynced_project
)
expect
(
GeoFileDownloadWorker
).
to
receive
(
:perform_async
).
once
.
and_return
(
spy
)
expect
(
GeoFileDownloadWorker
).
to
receive
(
:perform_async
)
.
with
(
:lfs
,
lfs_objec_in_synced_group
.
lfs_object_id
).
once
.
and_return
(
spy
)
subject
.
perform
subject
.
perform
end
end
it
'does not perform GeoFileDownloadWorker for upload objects that do not belong to selected namespaces to replicate'
do
it
'does not perform GeoFileDownloadWorker for upload objects that do not belong to selected namespaces to replicate'
do
avatar
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
avatar
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
create
(
:upload
,
model:
group_1
,
path:
avatar
)
avatar_in_synced_group
=
create
(
:upload
,
model:
synced_group
,
path:
avatar
)
create
(
:upload
,
model:
create
(
:group
),
path:
avatar
)
create
(
:upload
,
model:
create
(
:group
),
path:
avatar
)
create
(
:upload
,
model:
project_1
,
path:
avatar
)
avatar_in_project_in_synced_group
=
create
(
:upload
,
model:
project_in_synced_group
,
path:
avatar
)
create
(
:upload
,
model:
project_2
,
path:
avatar
)
create
(
:upload
,
model:
unsynced_project
,
path:
avatar
)
create
(
:note
,
:with_attachment
)
expect
(
GeoFileDownloadWorker
).
to
receive
(
:perform_async
).
exactly
(
3
).
times
.
and_return
(
spy
)
expect
(
GeoFileDownloadWorker
).
to
receive
(
:perform_async
)
.
with
(
'avatar'
,
avatar_in_project_in_synced_group
.
id
).
once
.
and_return
(
spy
)
expect
(
GeoFileDownloadWorker
).
to
receive
(
:perform_async
)
.
with
(
'avatar'
,
avatar_in_synced_group
.
id
).
once
.
and_return
(
spy
)
subject
.
perform
subject
.
perform
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