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
Léo-Paul Géneau
gitlab-ce
Commits
6d165c74
Commit
6d165c74
authored
Jun 05, 2018
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all uses of `fixture_file_upload` use relative paths
parent
0b4312c6
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
60 additions
and
58 deletions
+60
-58
spec/controllers/boards/issues_controller_spec.rb
spec/controllers/boards/issues_controller_spec.rb
+1
-1
spec/controllers/groups/avatars_controller_spec.rb
spec/controllers/groups/avatars_controller_spec.rb
+1
-1
spec/controllers/import/gitlab_projects_controller_spec.rb
spec/controllers/import/gitlab_projects_controller_spec.rb
+1
-1
spec/controllers/import/google_code_controller_spec.rb
spec/controllers/import/google_code_controller_spec.rb
+1
-1
spec/controllers/profiles/avatars_controller_spec.rb
spec/controllers/profiles/avatars_controller_spec.rb
+1
-1
spec/controllers/projects/avatars_controller_spec.rb
spec/controllers/projects/avatars_controller_spec.rb
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+2
-2
spec/controllers/uploads_controller_spec.rb
spec/controllers/uploads_controller_spec.rb
+7
-7
spec/factories/lfs_objects.rb
spec/factories/lfs_objects.rb
+1
-1
spec/factories/notes.rb
spec/factories/notes.rb
+2
-2
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+1
-1
spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb
...tures/merge_request/user_sees_mini_pipeline_graph_spec.rb
+2
-2
spec/features/projects/jobs_spec.rb
spec/features/projects/jobs_spec.rb
+1
-1
spec/features/projects/pages_spec.rb
spec/features/projects/pages_spec.rb
+2
-2
spec/lib/gitlab/import_export/avatar_saver_spec.rb
spec/lib/gitlab/import_export/avatar_saver_spec.rb
+1
-1
spec/lib/gitlab/import_export/uploads_saver_spec.rb
spec/lib/gitlab/import_export/uploads_saver_spec.rb
+1
-1
spec/models/ci/job_artifact_spec.rb
spec/models/ci/job_artifact_spec.rb
+2
-2
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+2
-2
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+2
-2
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+1
-1
spec/requests/openid_connect_spec.rb
spec/requests/openid_connect_spec.rb
+1
-1
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+1
-1
spec/services/projects/gitlab_projects_import_service_spec.rb
.../services/projects/gitlab_projects_import_service_spec.rb
+1
-1
spec/services/projects/participants_service_spec.rb
spec/services/projects/participants_service_spec.rb
+1
-1
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+5
-5
spec/services/upload_service_spec.rb
spec/services/upload_service_spec.rb
+5
-5
spec/support/rspec.rb
spec/support/rspec.rb
+2
-0
spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb
...d_examples/controllers/uploads_actions_shared_examples.rb
+2
-2
spec/uploaders/attachment_uploader_spec.rb
spec/uploaders/attachment_uploader_spec.rb
+1
-1
spec/uploaders/file_mover_spec.rb
spec/uploaders/file_mover_spec.rb
+1
-1
spec/uploaders/file_uploader_spec.rb
spec/uploaders/file_uploader_spec.rb
+1
-1
spec/uploaders/job_artifact_uploader_spec.rb
spec/uploaders/job_artifact_uploader_spec.rb
+1
-1
spec/uploaders/namespace_file_uploader_spec.rb
spec/uploaders/namespace_file_uploader_spec.rb
+1
-1
spec/uploaders/object_storage_spec.rb
spec/uploaders/object_storage_spec.rb
+1
-1
spec/uploaders/personal_file_uploader_spec.rb
spec/uploaders/personal_file_uploader_spec.rb
+1
-1
spec/uploaders/records_uploads_spec.rb
spec/uploaders/records_uploads_spec.rb
+1
-1
spec/uploaders/uploader_helper_spec.rb
spec/uploaders/uploader_helper_spec.rb
+1
-1
No files found.
spec/controllers/boards/issues_controller_spec.rb
View file @
6d165c74
...
...
@@ -18,7 +18,7 @@ describe Boards::IssuesController do
end
describe
'GET index'
,
:request_store
do
let
(
:johndoe
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/dk.png'
)))
}
let
(
:johndoe
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
File
.
join
(
'spec/fixtures/dk.png'
)))
}
context
'with invalid board id'
do
it
'returns a not found 404 response'
do
...
...
spec/controllers/groups/avatars_controller_spec.rb
View file @
6d165c74
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Groups
::
AvatarsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
))
}
before
do
group
.
add_owner
(
user
)
...
...
spec/controllers/import/gitlab_projects_controller_spec.rb
View file @
6d165c74
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Import
::
GitlabProjectsController
do
set
(
:namespace
)
{
create
(
:namespace
)
}
set
(
:user
)
{
namespace
.
owner
}
let
(
:file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:file
)
{
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
before
do
sign_in
(
user
)
...
...
spec/controllers/import/google_code_controller_spec.rb
View file @
6d165c74
...
...
@@ -4,7 +4,7 @@ describe Import::GoogleCodeController do
include
ImportSpecHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:dump_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/GoogleCodeProjectHosting.json'
,
'application/json'
)
}
let
(
:dump_file
)
{
fixture_file_upload
(
'spec/fixtures/GoogleCodeProjectHosting.json'
,
'application/json'
)
}
before
do
sign_in
(
user
)
...
...
spec/controllers/profiles/avatars_controller_spec.rb
View file @
6d165c74
require
'spec_helper'
describe
Profiles
::
AvatarsController
do
let
(
:user
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
))
}
let
(
:user
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
"spec/fixtures/dk.png"
))
}
before
do
sign_in
(
user
)
...
...
spec/controllers/projects/avatars_controller_spec.rb
View file @
6d165c74
require
'spec_helper'
describe
Projects
::
AvatarsController
do
let
(
:project
)
{
create
(
:project
,
:repository
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:project
)
{
create
(
:project
,
:repository
,
avatar:
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:user
)
{
create
(
:user
)
}
before
do
...
...
spec/controllers/projects_controller_spec.rb
View file @
6d165c74
...
...
@@ -6,8 +6,8 @@ describe ProjectsController do
let
(
:project
)
{
create
(
:project
)
}
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:jpg
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:jpg
)
{
fixture_file_upload
(
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
describe
'GET new'
do
context
'with an authenticated user'
do
...
...
spec/controllers/uploads_controller_spec.rb
View file @
6d165c74
...
...
@@ -6,13 +6,13 @@ shared_examples 'content not cached without revalidation' do
end
describe
UploadsController
do
let!
(
:user
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let!
(
:user
)
{
create
(
:user
,
avatar:
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
))
}
describe
'POST create'
do
let
(
:model
)
{
'personal_snippet'
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
)
}
let
(
:jpg
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:jpg
)
{
fixture_file_upload
(
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
context
'when a user does not have permissions to upload a file'
do
it
"returns 401 when the user is not logged in"
do
...
...
@@ -205,7 +205,7 @@ describe UploadsController do
end
context
"when viewing a project avatar"
do
let!
(
:project
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let!
(
:project
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
))
}
context
"when the project is public"
do
before
do
...
...
@@ -314,7 +314,7 @@ describe UploadsController do
end
context
"when viewing a group avatar"
do
let!
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let!
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
))
}
context
"when the group is public"
do
context
"when not signed in"
do
...
...
@@ -521,7 +521,7 @@ describe UploadsController do
context
'Appearance'
do
context
'when viewing a custom header logo'
do
let!
(
:appearance
)
{
create
:appearance
,
header_logo:
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
)
,
'image/png'
)
}
let!
(
:appearance
)
{
create
:appearance
,
header_logo:
fixture_file_upload
(
'spec/fixtures/dk.png'
,
'image/png'
)
}
context
'when not signed in'
do
it
'responds with status 200'
do
...
...
@@ -541,7 +541,7 @@ describe UploadsController do
end
context
'when viewing a custom logo'
do
let!
(
:appearance
)
{
create
:appearance
,
logo:
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
)
,
'image/png'
)
}
let!
(
:appearance
)
{
create
:appearance
,
logo:
fixture_file_upload
(
'spec/fixtures/dk.png'
,
'image/png'
)
}
context
'when not signed in'
do
it
'responds with status 200'
do
...
...
spec/factories/lfs_objects.rb
View file @
6d165c74
...
...
@@ -7,7 +7,7 @@ FactoryBot.define do
end
trait
:with_file
do
file
{
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"`/png"
)
}
file
{
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"`/png"
)
}
end
# The uniqueness constraint means we can't use the correct OID for all LFS
...
...
spec/factories/notes.rb
View file @
6d165c74
...
...
@@ -130,11 +130,11 @@ FactoryBot.define do
end
trait
:with_attachment
do
attachment
{
fixture_file_upload
(
Rails
.
root
.
join
(
"spec/fixtures/dk.png"
)
,
"image/png"
)
}
attachment
{
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
)
}
end
trait
:with_svg_attachment
do
attachment
{
fixture_file_upload
(
Rails
.
root
.
join
(
"spec/fixtures/unsanitized.svg"
)
,
"image/svg+xml"
)
}
attachment
{
fixture_file_upload
(
"spec/fixtures/unsanitized.svg"
,
"image/svg+xml"
)
}
end
transient
do
...
...
spec/features/commits_spec.rb
View file @
6d165c74
...
...
@@ -47,7 +47,7 @@ describe 'Commits' do
context
'commit status is Ci Build'
do
let!
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:artifacts_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:artifacts_file
)
{
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
context
'when logged as developer'
do
before
do
...
...
spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb
View file @
6d165c74
...
...
@@ -23,8 +23,8 @@ describe 'Merge request < User sees mini pipeline graph', :js do
end
context
'as json'
do
let
(
:artifacts_file1
)
{
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/banana_sample.gif'
),
'image/gif'
)
}
let
(
:artifacts_file2
)
{
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
),
'image/png'
)
}
let
(
:artifacts_file1
)
{
fixture_file_upload
(
File
.
join
(
'spec/fixtures/banana_sample.gif'
),
'image/gif'
)
}
let
(
:artifacts_file2
)
{
fixture_file_upload
(
File
.
join
(
'spec/fixtures/dk.png'
),
'image/png'
)
}
before
do
create
(
:ci_build
,
:success
,
:trace_artifact
,
pipeline:
pipeline
,
legacy_artifacts_file:
artifacts_file1
)
...
...
spec/features/projects/jobs_spec.rb
View file @
6d165c74
...
...
@@ -11,7 +11,7 @@ feature 'Jobs', :clean_gitlab_redis_shared_state do
let
(
:job2
)
{
create
(
:ci_build
)
}
let
(
:artifacts_file
)
do
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
end
before
do
...
...
spec/features/projects/pages_spec.rb
View file @
6d165c74
...
...
@@ -314,8 +314,8 @@ feature 'Pages' do
project:
project
,
pipeline:
pipeline
,
ref:
'HEAD'
,
legacy_artifacts_file:
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/pages.zip'
)),
legacy_artifacts_metadata:
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/pages.zip.meta'
))
legacy_artifacts_file:
fixture_file_upload
(
File
.
join
(
'spec/fixtures/pages.zip'
)),
legacy_artifacts_metadata:
fixture_file_upload
(
File
.
join
(
'spec/fixtures/pages.zip.meta'
))
)
end
...
...
spec/lib/gitlab/import_export/avatar_saver_spec.rb
View file @
6d165c74
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
AvatarSaver
do
let
(
:shared
)
{
project
.
import_export_shared
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:project_with_avatar
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:project_with_avatar
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:project
)
{
create
(
:project
)
}
before
do
...
...
spec/lib/gitlab/import_export/uploads_saver_spec.rb
View file @
6d165c74
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
UploadsSaver
do
describe
'bundle a project Git repo'
do
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/uploads_saver_spec"
}
let
(
:file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:file
)
{
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:shared
)
{
project
.
import_export_shared
}
before
do
...
...
spec/models/ci/job_artifact_spec.rb
View file @
6d165c74
...
...
@@ -76,12 +76,12 @@ describe Ci::JobArtifact do
context
'updating the artifact file'
do
it
'updates the artifact size'
do
artifact
.
update!
(
file:
fixture_file_upload
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/dk.png'
)
))
artifact
.
update!
(
file:
fixture_file_upload
(
'spec/fixtures/dk.png'
))
expect
(
artifact
.
size
).
to
eq
(
1062
)
end
it
'updates the project statistics'
do
expect
{
artifact
.
update!
(
file:
fixture_file_upload
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/dk.png'
)
))
}
expect
{
artifact
.
update!
(
file:
fixture_file_upload
(
'spec/fixtures/dk.png'
))
}
.
to
change
{
artifact
.
project
.
statistics
.
reload
.
build_artifacts_size
}
.
by
(
1062
-
106365
)
end
...
...
spec/requests/api/projects_spec.rb
View file @
6d165c74
...
...
@@ -518,7 +518,7 @@ describe API::Projects do
end
it
'uploads avatar for project a project'
do
project
=
attributes_for
(
:project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
))
project
=
attributes_for
(
:project
,
avatar:
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
))
post
api
(
'/projects'
,
user
),
project
...
...
@@ -777,7 +777,7 @@ describe API::Projects do
end
it
"uploads the file and returns its info"
do
post
api
(
"/projects/
#{
project
.
id
}
/uploads"
,
user
),
file:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
)
post
api
(
"/projects/
#{
project
.
id
}
/uploads"
,
user
),
file:
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'alt'
]).
to
eq
(
"dk"
)
...
...
spec/requests/api/runner_spec.rb
View file @
6d165c74
...
...
@@ -1055,8 +1055,8 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
let
(
:jwt_token
)
{
JWT
.
encode
({
'iss'
=>
'gitlab-workhorse'
},
Gitlab
::
Workhorse
.
secret
,
'HS256'
)
}
let
(
:headers
)
{
{
'GitLab-Workhorse'
=>
'1.0'
,
Gitlab
::
Workhorse
::
INTERNAL_API_REQUEST_HEADER
=>
jwt_token
}
}
let
(
:headers_with_token
)
{
headers
.
merge
(
API
::
Helpers
::
Runner
::
JOB_TOKEN_HEADER
=>
job
.
token
)
}
let
(
:file_upload
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:file_upload2
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
,
'image/gif'
)
}
let
(
:file_upload
)
{
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:file_upload2
)
{
fixture_file_upload
(
'spec/fixtures/dk.png'
,
'image/gif'
)
}
before
do
stub_artifacts_object_storage
...
...
spec/requests/api/users_spec.rb
View file @
6d165c74
...
...
@@ -512,7 +512,7 @@ describe API::Users do
end
it
'updates user with avatar'
do
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
{
avatar:
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
{
avatar:
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
user
.
reload
...
...
spec/requests/openid_connect_spec.rb
View file @
6d165c74
...
...
@@ -61,7 +61,7 @@ describe 'OpenID Connect requests' do
email:
private_email
.
email
,
public_email:
public_email
.
email
,
website_url:
'https://example.com'
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
)
avatar:
fixture_file_upload
(
'spec/fixtures/dk.png'
)
)
end
...
...
spec/services/projects/fork_service_spec.rb
View file @
6d165c74
...
...
@@ -8,7 +8,7 @@ describe Projects::ForkService do
before
do
@from_user
=
create
(
:user
)
@from_namespace
=
@from_user
.
namespace
avatar
=
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
)
avatar
=
fixture_file_upload
(
"spec/fixtures/dk.png"
,
"image/png"
)
@from_project
=
create
(
:project
,
:repository
,
creator_id:
@from_user
.
id
,
...
...
spec/services/projects/gitlab_projects_import_service_spec.rb
View file @
6d165c74
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Projects
::
GitlabProjectsImportService
do
set
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:path
)
{
'test-path'
}
let
(
:file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:file
)
{
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:overwrite
)
{
false
}
let
(
:import_params
)
{
{
namespace_id:
namespace
.
id
,
path:
path
,
file:
file
,
overwrite:
overwrite
}
}
subject
{
described_class
.
new
(
namespace
.
owner
,
import_params
)
}
...
...
spec/services/projects/participants_service_spec.rb
View file @
6d165c74
...
...
@@ -4,7 +4,7 @@ describe Projects::ParticipantsService do
describe
'#groups'
do
describe
'avatar_url'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
))
}
let
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
'spec/fixtures/dk.png'
))
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
group:
group
,
user:
user
)
}
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
6d165c74
...
...
@@ -4,11 +4,11 @@ describe Projects::UpdatePagesService do
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
(
'HEAD'
).
sha
)
}
set
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
ref:
'HEAD'
)
}
let
(
:invalid_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
)
}
let
(
:invalid_file
)
{
fixture_file_upload
(
'spec/fixtures/dk.png'
)
}
let
(
:extension
)
{
'zip'
}
let
(
:file
)
{
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/pages.
#{
extension
}
"
)
}
let
(
:empty_file
)
{
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/pages_empty.
#{
extension
}
"
)
}
let
(
:file
)
{
fixture_file_upload
(
"spec/fixtures/pages.
#{
extension
}
"
)
}
let
(
:empty_file
)
{
fixture_file_upload
(
"spec/fixtures/pages_empty.
#{
extension
}
"
)
}
let
(
:metadata
)
do
filename
=
Rails
.
root
+
"spec/fixtures/pages.
#{
extension
}
.meta"
fixture_file_upload
(
filename
)
if
File
.
exist?
(
filename
)
...
...
@@ -196,8 +196,8 @@ describe Projects::UpdatePagesService do
let
(
:metadata
)
{
spy
(
'metadata'
)
}
before
do
file
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/pages.zip'
)
metafile
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/pages.zip.meta'
)
file
=
fixture_file_upload
(
'spec/fixtures/pages.zip'
)
metafile
=
fixture_file_upload
(
'spec/fixtures/pages.zip.meta'
)
build
.
update_attributes
(
legacy_artifacts_file:
file
)
build
.
update_attributes
(
legacy_artifacts_metadata:
metafile
)
...
...
spec/services/upload_service_spec.rb
View file @
6d165c74
...
...
@@ -9,7 +9,7 @@ describe UploadService do
context
'for valid gif file'
do
before
do
gif
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
gif
=
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
@link_to_file
=
upload_file
(
@project
,
gif
)
end
...
...
@@ -21,7 +21,7 @@ describe UploadService do
context
'for valid png file'
do
before
do
png
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
,
png
=
fixture_file_upload
(
'spec/fixtures/dk.png'
,
'image/png'
)
@link_to_file
=
upload_file
(
@project
,
png
)
end
...
...
@@ -34,7 +34,7 @@ describe UploadService do
context
'for valid jpg file'
do
before
do
jpg
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
jpg
=
fixture_file_upload
(
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
@link_to_file
=
upload_file
(
@project
,
jpg
)
end
...
...
@@ -46,7 +46,7 @@ describe UploadService do
context
'for txt file'
do
before
do
txt
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
txt
=
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
@link_to_file
=
upload_file
(
@project
,
txt
)
end
...
...
@@ -58,7 +58,7 @@ describe UploadService do
context
'for too large a file'
do
before
do
txt
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
txt
=
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
allow
(
txt
).
to
receive
(
:size
)
{
1000
.
megabytes
.
to_i
}
@link_to_file
=
upload_file
(
@project
,
txt
)
end
...
...
spec/support/rspec.rb
View file @
6d165c74
...
...
@@ -9,4 +9,6 @@ RSpec.configure do |config|
config
.
include
StubConfiguration
config
.
include
StubObjectStorage
config
.
include
StubENV
config
.
fixture_path
=
Rails
.
root
if
defined?
(
Rails
)
end
spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb
View file @
6d165c74
shared_examples
'handle uploads'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:jpg
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:jpg
)
{
fixture_file_upload
(
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:secret
)
{
FileUploader
.
generate_secret
}
let
(
:uploader_class
)
{
FileUploader
}
...
...
spec/uploaders/attachment_uploader_spec.rb
View file @
6d165c74
...
...
@@ -26,7 +26,7 @@ describe AttachmentUploader do
describe
"#migrate!"
do
before
do
uploader
.
store!
(
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/doc_sample.txt'
)))
uploader
.
store!
(
fixture_file_upload
(
File
.
join
(
'spec/fixtures/doc_sample.txt'
)))
stub_uploads_object_storage
end
...
...
spec/uploaders/file_mover_spec.rb
View file @
6d165c74
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
FileMover
do
let
(
:filename
)
{
'banana_sample.gif'
}
let
(
:file
)
{
fixture_file_upload
(
Rails
.
root
.
join
(
'spec'
,
'fixtures'
,
filename
))
}
let
(
:file
)
{
fixture_file_upload
(
File
.
join
(
'spec'
,
'fixtures'
,
filename
))
}
let
(
:temp_file_path
)
{
File
.
join
(
'uploads/-/system/temp'
,
'secret55'
,
filename
)
}
let
(
:temp_description
)
do
...
...
spec/uploaders/file_uploader_spec.rb
View file @
6d165c74
...
...
@@ -89,7 +89,7 @@ describe FileUploader do
describe
"#migrate!"
do
before
do
uploader
.
store!
(
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
)
))
uploader
.
store!
(
fixture_file_upload
(
'spec/fixtures/dk.png'
))
stub_uploads_object_storage
end
...
...
spec/uploaders/job_artifact_uploader_spec.rb
View file @
6d165c74
...
...
@@ -81,7 +81,7 @@ describe JobArtifactUploader do
describe
"#migrate!"
do
before
do
uploader
.
store!
(
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/trace/sample_trace'
)))
uploader
.
store!
(
fixture_file_upload
(
File
.
join
(
'spec/fixtures/trace/sample_trace'
)))
stub_artifacts_object_storage
end
...
...
spec/uploaders/namespace_file_uploader_spec.rb
View file @
6d165c74
...
...
@@ -28,7 +28,7 @@ describe NamespaceFileUploader do
describe
"#migrate!"
do
before
do
uploader
.
store!
(
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/doc_sample.txt'
)))
uploader
.
store!
(
fixture_file_upload
(
File
.
join
(
'spec/fixtures/doc_sample.txt'
)))
stub_uploads_object_storage
end
...
...
spec/uploaders/object_storage_spec.rb
View file @
6d165c74
...
...
@@ -571,7 +571,7 @@ describe ObjectStorage do
context
'when local file is used'
do
context
'when valid file is used'
do
let
(
:uploaded_file
)
do
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
fixture_file_upload
(
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
end
it
"properly caches the file"
do
...
...
spec/uploaders/personal_file_uploader_spec.rb
View file @
6d165c74
...
...
@@ -45,7 +45,7 @@ describe PersonalFileUploader do
describe
"#migrate!"
do
before
do
uploader
.
store!
(
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/doc_sample.txt'
)
))
uploader
.
store!
(
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
))
stub_uploads_object_storage
end
...
...
spec/uploaders/records_uploads_spec.rb
View file @
6d165c74
...
...
@@ -16,7 +16,7 @@ describe RecordsUploads do
end
def
upload_fixture
(
filename
)
fixture_file_upload
(
Rails
.
root
.
join
(
'spec'
,
'fixtures'
,
filename
))
fixture_file_upload
(
File
.
join
(
'spec'
,
'fixtures'
,
filename
))
end
describe
'callbacks'
do
...
...
spec/uploaders/uploader_helper_spec.rb
View file @
6d165c74
...
...
@@ -12,7 +12,7 @@ describe UploaderHelper do
end
def
upload_fixture
(
filename
)
fixture_file_upload
(
Rails
.
root
.
join
(
'spec'
,
'fixtures'
,
filename
))
fixture_file_upload
(
File
.
join
(
'spec'
,
'fixtures'
,
filename
))
end
describe
'#image_or_video?'
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