BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
acde0e3f
Commit
acde0e3f
authored
Dec 12, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec by avoiding monkeypatching
parent
2df1f4a5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
populate_untracked_uploads_spec.rb
...b/background_migration/populate_untracked_uploads_spec.rb
+13
-4
No files found.
spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb
View file @
acde0e3f
...
...
@@ -182,13 +182,22 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads, :sidekiq do
end
context
'for a pre-Markdown Note attachment file path'
do
class
Note
<
ActiveRecord
::
Base
has_many
:uploads
,
as: :model
,
dependent: :destroy
let
(
:model
)
{
create
(
:note
,
:with_attachment
)
}
let!
(
:expected_upload_attrs
)
{
Upload
.
where
(
model_type:
'Note'
,
model_id:
model
.
id
).
first
.
attributes
.
slice
(
'path'
,
'uploader'
,
'size'
,
'checksum'
)
}
let!
(
:untracked_file
)
{
untracked_files_for_uploads
.
create!
(
path:
expected_upload_attrs
[
'path'
])
}
before
do
Upload
.
where
(
model_type:
'Note'
,
model_id:
model
.
id
).
delete_all
end
let
(
:model
)
{
create
(
:note
,
:with_attachment
)
}
# Can't use the shared example because Note doesn't have an `uploads` association
it
'creates an Upload record'
do
expect
do
subject
.
perform
(
1
,
untracked_files_for_uploads
.
last
.
id
)
end
.
to
change
{
Upload
.
where
(
model_type:
'Note'
,
model_id:
model
.
id
).
count
}.
from
(
0
).
to
(
1
)
it_behaves_like
'non_markdown_file'
expect
(
Upload
.
where
(
model_type:
'Note'
,
model_id:
model
.
id
).
first
.
attributes
).
to
include
(
expected_upload_attrs
)
end
end
context
'for a user avatar file path'
do
...
...
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