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
ef688d84
Commit
ef688d84
authored
Jan 25, 2022
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace owner with first_owner in various specs
parent
99be341f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
31 additions
and
31 deletions
+31
-31
spec/serializers/build_details_entity_spec.rb
spec/serializers/build_details_entity_spec.rb
+1
-1
spec/serializers/ci/lint/result_serializer_spec.rb
spec/serializers/ci/lint/result_serializer_spec.rb
+2
-2
spec/serializers/diff_file_base_entity_spec.rb
spec/serializers/diff_file_base_entity_spec.rb
+1
-1
spec/serializers/runner_entity_spec.rb
spec/serializers/runner_entity_spec.rb
+1
-1
spec/serializers/trigger_variable_entity_spec.rb
spec/serializers/trigger_variable_entity_spec.rb
+1
-1
spec/support/helpers/repo_helpers.rb
spec/support/helpers/repo_helpers.rb
+1
-1
spec/support/shared_contexts/graphql/requests/packages_shared_context.rb
...ared_contexts/graphql/requests/packages_shared_context.rb
+1
-1
spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb
...mples/features/creatable_merge_request_shared_examples.rb
+1
-1
spec/support/shared_examples/lib/sidebars/projects/menus/zentao_menu_shared_examples.rb
...ib/sidebars/projects/menus/zentao_menu_shared_examples.rb
+1
-1
spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
...mples/models/update_project_statistics_shared_examples.rb
+2
-2
spec/support/shared_examples/requests/api/notes_shared_examples.rb
...ort/shared_examples/requests/api/notes_shared_examples.rb
+1
-1
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+2
-2
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+1
-1
spec/workers/ci/external_pull_requests/create_pipeline_worker_spec.rb
.../ci/external_pull_requests/create_pipeline_worker_spec.rb
+1
-1
spec/workers/cleanup_container_repository_worker_spec.rb
spec/workers/cleanup_container_repository_worker_spec.rb
+1
-1
spec/workers/delete_container_repository_worker_spec.rb
spec/workers/delete_container_repository_worker_spec.rb
+1
-1
spec/workers/delete_merged_branches_worker_spec.rb
spec/workers/delete_merged_branches_worker_spec.rb
+2
-2
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+8
-8
spec/workers/project_destroy_worker_spec.rb
spec/workers/project_destroy_worker_spec.rb
+2
-2
No files found.
spec/serializers/build_details_entity_spec.rb
View file @
ef688d84
...
@@ -11,7 +11,7 @@ RSpec.describe BuildDetailsEntity do
...
@@ -11,7 +11,7 @@ RSpec.describe BuildDetailsEntity do
describe
'#as_json'
do
describe
'#as_json'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
:failed
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
:failed
,
pipeline:
pipeline
)
}
let
(
:request
)
{
double
(
'request'
,
project:
project
)
}
let
(
:request
)
{
double
(
'request'
,
project:
project
)
}
...
...
spec/serializers/ci/lint/result_serializer_spec.rb
View file @
ef688d84
...
@@ -7,7 +7,7 @@ RSpec.describe Ci::Lint::ResultSerializer, :aggregate_failures do
...
@@ -7,7 +7,7 @@ RSpec.describe Ci::Lint::ResultSerializer, :aggregate_failures do
let
(
:result
)
do
let
(
:result
)
do
Gitlab
::
Ci
::
Lint
Gitlab
::
Ci
::
Lint
.
new
(
project:
project
,
current_user:
project
.
owner
)
.
new
(
project:
project
,
current_user:
project
.
first_
owner
)
.
validate
(
yaml_content
,
dry_run:
false
)
.
validate
(
yaml_content
,
dry_run:
false
)
end
end
...
@@ -64,7 +64,7 @@ RSpec.describe Ci::Lint::ResultSerializer, :aggregate_failures do
...
@@ -64,7 +64,7 @@ RSpec.describe Ci::Lint::ResultSerializer, :aggregate_failures do
context
'when dry run is enabled'
do
context
'when dry run is enabled'
do
let
(
:result
)
do
let
(
:result
)
do
Gitlab
::
Ci
::
Lint
Gitlab
::
Ci
::
Lint
.
new
(
project:
project
,
current_user:
project
.
owner
)
.
new
(
project:
project
,
current_user:
project
.
first_
owner
)
.
validate
(
yaml_content
,
dry_run:
true
)
.
validate
(
yaml_content
,
dry_run:
true
)
end
end
...
...
spec/serializers/diff_file_base_entity_spec.rb
View file @
ef688d84
...
@@ -142,7 +142,7 @@ RSpec.describe DiffFileBaseEntity do
...
@@ -142,7 +142,7 @@ RSpec.describe DiffFileBaseEntity do
end
end
context
'when source_project and target_project are different'
do
context
'when source_project and target_project are different'
do
let
(
:target_project
)
{
fork_project
(
source_project
,
source_project
.
owner
,
repository:
true
)
}
let
(
:target_project
)
{
fork_project
(
source_project
,
source_project
.
first_
owner
,
repository:
true
)
}
it
'returns the merge_request ide route with the target_project as param'
do
it
'returns the merge_request ide route with the target_project as param'
do
expect
(
entity
[
:ide_edit_path
]).
to
eq
(
"
#{
expected_merge_request_path
}
?target_project=
#{
ERB
::
Util
.
url_encode
(
target_project
.
full_path
)
}
"
)
expect
(
entity
[
:ide_edit_path
]).
to
eq
(
"
#{
expected_merge_request_path
}
?target_project=
#{
ERB
::
Util
.
url_encode
(
target_project
.
full_path
)
}
"
)
...
...
spec/serializers/runner_entity_spec.rb
View file @
ef688d84
...
@@ -7,7 +7,7 @@ RSpec.describe RunnerEntity do
...
@@ -7,7 +7,7 @@ RSpec.describe RunnerEntity do
let
(
:runner
)
{
create
(
:ci_runner
,
:project
,
projects:
[
project
])
}
let
(
:runner
)
{
create
(
:ci_runner
,
:project
,
projects:
[
project
])
}
let
(
:entity
)
{
described_class
.
new
(
runner
,
request:
request
,
current_user:
user
)
}
let
(
:entity
)
{
described_class
.
new
(
runner
,
request:
request
,
current_user:
user
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
before
do
before
do
allow
(
request
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
request
).
to
receive
(
:current_user
).
and_return
(
user
)
...
...
spec/serializers/trigger_variable_entity_spec.rb
View file @
ef688d84
...
@@ -31,7 +31,7 @@ RSpec.describe TriggerVariableEntity do
...
@@ -31,7 +31,7 @@ RSpec.describe TriggerVariableEntity do
end
end
context
'when user is owner'
do
context
'when user is owner'
do
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
it
'exposes the variable value'
do
it
'exposes the variable value'
do
expect
(
subject
).
to
include
(
:value
)
expect
(
subject
).
to
include
(
:value
)
...
...
spec/support/helpers/repo_helpers.rb
View file @
ef688d84
...
@@ -129,7 +129,7 @@ eos
...
@@ -129,7 +129,7 @@ eos
commit_message:
'Add new content'
)
commit_message:
'Add new content'
)
Files
::
CreateService
.
new
(
Files
::
CreateService
.
new
(
project
,
project
,
project
.
owner
,
project
.
first_
owner
,
commit_message:
commit_message
,
commit_message:
commit_message
,
start_branch:
start_branch
,
start_branch:
start_branch
,
branch_name:
branch_name
,
branch_name:
branch_name
,
...
...
spec/support/shared_contexts/graphql/requests/packages_shared_context.rb
View file @
ef688d84
...
@@ -11,7 +11,7 @@ RSpec.shared_context 'package details setup' do
...
@@ -11,7 +11,7 @@ RSpec.shared_context 'package details setup' do
let
(
:package_files
)
{
all_graphql_fields_for
(
'PackageFile'
)
}
let
(
:package_files
)
{
all_graphql_fields_for
(
'PackageFile'
)
}
let
(
:dependency_links
)
{
all_graphql_fields_for
(
'PackageDependencyLink'
)
}
let
(
:dependency_links
)
{
all_graphql_fields_for
(
'PackageDependencyLink'
)
}
let
(
:pipelines
)
{
all_graphql_fields_for
(
'Pipeline'
,
max_depth:
1
)
}
let
(
:pipelines
)
{
all_graphql_fields_for
(
'Pipeline'
,
max_depth:
1
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
let
(
:package_details
)
{
graphql_data_at
(
:package
)
}
let
(
:package_details
)
{
graphql_data_at
(
:package
)
}
let
(
:metadata_response
)
{
graphql_data_at
(
:package
,
:metadata
)
}
let
(
:metadata_response
)
{
graphql_data_at
(
:package
,
:metadata
)
}
let
(
:first_file
)
{
package
.
package_files
.
find
{
|
f
|
global_id_of
(
f
)
==
first_file_response
[
'id'
]
}
}
let
(
:first_file
)
{
package
.
package_files
.
find
{
|
f
|
global_id_of
(
f
)
==
first_file_response
[
'id'
]
}
}
...
...
spec/support/shared_examples/features/creatable_merge_request_shared_examples.rb
View file @
ef688d84
...
@@ -62,7 +62,7 @@ RSpec.shared_examples 'a creatable merge request' do
...
@@ -62,7 +62,7 @@ RSpec.shared_examples 'a creatable merge request' do
end
end
it
'updates the branches when selecting a new target project'
,
:js
do
it
'updates the branches when selecting a new target project'
,
:js
do
target_project_member
=
target_project
.
owner
target_project_member
=
target_project
.
first_
owner
::
Branches
::
CreateService
.
new
(
target_project
,
target_project_member
)
::
Branches
::
CreateService
.
new
(
target_project
,
target_project_member
)
.
execute
(
'a-brand-new-branch-to-test'
,
'master'
)
.
execute
(
'a-brand-new-branch-to-test'
,
'master'
)
...
...
spec/support/shared_examples/lib/sidebars/projects/menus/zentao_menu_shared_examples.rb
View file @
ef688d84
...
@@ -4,7 +4,7 @@ require 'spec_helper'
...
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec
.
shared_examples
'ZenTao menu with CE version'
do
RSpec
.
shared_examples
'ZenTao menu with CE version'
do
let
(
:project
)
{
create
(
:project
,
has_external_issue_tracker:
true
)
}
let
(
:project
)
{
create
(
:project
,
has_external_issue_tracker:
true
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
let
(
:context
)
{
Sidebars
::
Projects
::
Context
.
new
(
current_user:
user
,
container:
project
)
}
let
(
:context
)
{
Sidebars
::
Projects
::
Context
.
new
(
current_user:
user
,
container:
project
)
}
let
(
:zentao_integration
)
{
create
(
:zentao_integration
,
project:
project
)
}
let
(
:zentao_integration
)
{
create
(
:zentao_integration
,
project:
project
)
}
...
...
spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
View file @
ef688d84
...
@@ -115,14 +115,14 @@ RSpec.shared_examples 'UpdateProjectStatistics' do |with_counter_attribute|
...
@@ -115,14 +115,14 @@ RSpec.shared_examples 'UpdateProjectStatistics' do |with_counter_attribute|
expect
(
ProjectStatistics
)
expect
(
ProjectStatistics
)
.
not_to
receive
(
:increment_statistic
)
.
not_to
receive
(
:increment_statistic
)
expect
(
Projects
::
DestroyService
.
new
(
project
,
project
.
owner
).
execute
).
to
eq
(
true
)
expect
(
Projects
::
DestroyService
.
new
(
project
,
project
.
first_
owner
).
execute
).
to
eq
(
true
)
end
end
it
'does not schedule a namespace statistics worker'
do
it
'does not schedule a namespace statistics worker'
do
expect
(
Namespaces
::
ScheduleAggregationWorker
)
expect
(
Namespaces
::
ScheduleAggregationWorker
)
.
not_to
receive
(
:perform_async
)
.
not_to
receive
(
:perform_async
)
expect
(
Projects
::
DestroyService
.
new
(
project
,
project
.
owner
).
execute
).
to
eq
(
true
)
expect
(
Projects
::
DestroyService
.
new
(
project
,
project
.
first_
owner
).
execute
).
to
eq
(
true
)
end
end
end
end
end
end
...
...
spec/support/shared_examples/requests/api/notes_shared_examples.rb
View file @
ef688d84
...
@@ -190,7 +190,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
...
@@ -190,7 +190,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
if
parent_type
==
'projects'
if
parent_type
==
'projects'
context
'by a project owner'
do
context
'by a project owner'
do
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
it
'sets the creation time on the new note'
do
it
'sets the creation time on the new note'
do
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user
),
params:
params
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user
),
params:
params
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
ef688d84
...
@@ -344,9 +344,9 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
...
@@ -344,9 +344,9 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
shared_examples
'includes repositories in all repository storages'
do
shared_examples
'includes repositories in all repository storages'
do
specify
:aggregate_failures
do
specify
:aggregate_failures
do
project_a
=
create
(
:project
,
:repository
)
project_a
=
create
(
:project
,
:repository
)
project_snippet_a
=
create
(
:project_snippet
,
:repository
,
project:
project_a
,
author:
project_a
.
owner
)
project_snippet_a
=
create
(
:project_snippet
,
:repository
,
project:
project_a
,
author:
project_a
.
first_
owner
)
project_b
=
create
(
:project
,
:repository
,
repository_storage:
second_storage_name
)
project_b
=
create
(
:project
,
:repository
,
repository_storage:
second_storage_name
)
project_snippet_b
=
create
(
:project_snippet
,
:repository
,
project:
project_b
,
author:
project_b
.
owner
)
project_snippet_b
=
create
(
:project_snippet
,
:repository
,
project:
project_b
,
author:
project_b
.
first_
owner
)
project_snippet_b
.
snippet_repository
.
update!
(
shard:
project_b
.
project_repository
.
shard
)
project_snippet_b
.
snippet_repository
.
update!
(
shard:
project_b
.
project_repository
.
shard
)
create
(
:wiki_page
,
container:
project_a
)
create
(
:wiki_page
,
container:
project_a
)
create
(
:design
,
:with_file
,
issue:
create
(
:issue
,
project:
project_a
))
create
(
:design
,
:with_file
,
issue:
create
(
:issue
,
project:
project_a
))
...
...
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
View file @
ef688d84
...
@@ -5,7 +5,7 @@ require 'spec_helper'
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
'layouts/nav/sidebar/_project'
do
RSpec
.
describe
'layouts/nav/sidebar/_project'
do
let_it_be_with_reload
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be_with_reload
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
let
(
:current_ref
)
{
'master'
}
let
(
:current_ref
)
{
'master'
}
before
do
before
do
...
...
spec/workers/ci/external_pull_requests/create_pipeline_worker_spec.rb
View file @
ef688d84
...
@@ -4,7 +4,7 @@ require 'spec_helper'
...
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec
.
describe
Ci
::
ExternalPullRequests
::
CreatePipelineWorker
do
RSpec
.
describe
Ci
::
ExternalPullRequests
::
CreatePipelineWorker
do
let_it_be
(
:project
)
{
create
(
:project
,
:auto_devops
,
:repository
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:auto_devops
,
:repository
)
}
let_it_be
(
:user
)
{
project
.
owner
}
let_it_be
(
:user
)
{
project
.
first_
owner
}
let_it_be
(
:external_pull_request
)
do
let_it_be
(
:external_pull_request
)
do
branch
=
project
.
repository
.
branches
.
last
branch
=
project
.
repository
.
branches
.
last
create
(
:external_pull_request
,
project:
project
,
source_branch:
branch
.
name
,
source_sha:
branch
.
target
)
create
(
:external_pull_request
,
project:
project
,
source_branch:
branch
.
name
,
source_sha:
branch
.
target
)
...
...
spec/workers/cleanup_container_repository_worker_spec.rb
View file @
ef688d84
...
@@ -5,7 +5,7 @@ require 'spec_helper'
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
CleanupContainerRepositoryWorker
,
:clean_gitlab_redis_shared_state
do
RSpec
.
describe
CleanupContainerRepositoryWorker
,
:clean_gitlab_redis_shared_state
do
let
(
:repository
)
{
create
(
:container_repository
)
}
let
(
:repository
)
{
create
(
:container_repository
)
}
let
(
:project
)
{
repository
.
project
}
let
(
:project
)
{
repository
.
project
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
subject
{
described_class
.
new
}
subject
{
described_class
.
new
}
...
...
spec/workers/delete_container_repository_worker_spec.rb
View file @
ef688d84
...
@@ -5,7 +5,7 @@ require 'spec_helper'
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
DeleteContainerRepositoryWorker
do
RSpec
.
describe
DeleteContainerRepositoryWorker
do
let
(
:registry
)
{
create
(
:container_repository
)
}
let
(
:registry
)
{
create
(
:container_repository
)
}
let
(
:project
)
{
registry
.
project
}
let
(
:project
)
{
registry
.
project
}
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
first_
owner
}
subject
{
described_class
.
new
}
subject
{
described_class
.
new
}
...
...
spec/workers/delete_merged_branches_worker_spec.rb
View file @
ef688d84
...
@@ -13,11 +13,11 @@ RSpec.describe DeleteMergedBranchesWorker do
...
@@ -13,11 +13,11 @@ RSpec.describe DeleteMergedBranchesWorker do
expect
(
instance
).
to
receive
(
:execute
).
and_return
(
true
)
expect
(
instance
).
to
receive
(
:execute
).
and_return
(
true
)
end
end
worker
.
perform
(
project
.
id
,
project
.
owner
.
id
)
worker
.
perform
(
project
.
id
,
project
.
first_
owner
.
id
)
end
end
it
"returns false when project was not found"
do
it
"returns false when project was not found"
do
expect
(
worker
.
perform
(
'unknown'
,
project
.
owner
.
id
)).
to
be_falsy
expect
(
worker
.
perform
(
'unknown'
,
project
.
first_
owner
.
id
)).
to
be_falsy
end
end
end
end
end
end
spec/workers/post_receive_spec.rb
View file @
ef688d84
...
@@ -15,7 +15,7 @@ RSpec.describe PostReceive do
...
@@ -15,7 +15,7 @@ RSpec.describe PostReceive do
let
(
:wrongly_encoded_changes
)
{
changes
.
encode
(
"ISO-8859-1"
).
force_encoding
(
"UTF-8"
)
}
let
(
:wrongly_encoded_changes
)
{
changes
.
encode
(
"ISO-8859-1"
).
force_encoding
(
"UTF-8"
)
}
let
(
:base64_changes
)
{
Base64
.
encode64
(
wrongly_encoded_changes
)
}
let
(
:base64_changes
)
{
Base64
.
encode64
(
wrongly_encoded_changes
)
}
let
(
:gl_repository
)
{
"project-
#{
project
.
id
}
"
}
let
(
:gl_repository
)
{
"project-
#{
project
.
id
}
"
}
let
(
:key
)
{
create
(
:key
,
user:
project
.
owner
)
}
let
(
:key
)
{
create
(
:key
,
user:
project
.
first_
owner
)
}
let!
(
:key_id
)
{
key
.
shell_id
}
let!
(
:key_id
)
{
key
.
shell_id
}
let
(
:project
)
do
let
(
:project
)
do
...
@@ -47,7 +47,7 @@ RSpec.describe PostReceive do
...
@@ -47,7 +47,7 @@ RSpec.describe PostReceive do
context
'with PersonalSnippet'
do
context
'with PersonalSnippet'
do
let
(
:gl_repository
)
{
"snippet-
#{
snippet
.
id
}
"
}
let
(
:gl_repository
)
{
"snippet-
#{
snippet
.
id
}
"
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
author:
project
.
owner
)
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
author:
project
.
first_
owner
)
}
it
'does not log an error'
do
it
'does not log an error'
do
expect
(
Gitlab
::
GitLogger
).
not_to
receive
(
:error
)
expect
(
Gitlab
::
GitLogger
).
not_to
receive
(
:error
)
...
@@ -60,7 +60,7 @@ RSpec.describe PostReceive do
...
@@ -60,7 +60,7 @@ RSpec.describe PostReceive do
context
'with ProjectSnippet'
do
context
'with ProjectSnippet'
do
let
(
:gl_repository
)
{
"snippet-
#{
snippet
.
id
}
"
}
let
(
:gl_repository
)
{
"snippet-
#{
snippet
.
id
}
"
}
let
(
:snippet
)
{
create
(
:snippet
,
type:
'ProjectSnippet'
,
project:
nil
,
author:
project
.
owner
)
}
let
(
:snippet
)
{
create
(
:snippet
,
type:
'ProjectSnippet'
,
project:
nil
,
author:
project
.
first_
owner
)
}
it
'returns false and logs an error'
do
it
'returns false and logs an error'
do
expect
(
Gitlab
::
GitLogger
).
to
receive
(
:error
).
with
(
"POST-RECEIVE:
#{
error_message
}
"
)
expect
(
Gitlab
::
GitLogger
).
to
receive
(
:error
).
with
(
"POST-RECEIVE:
#{
error_message
}
"
)
...
@@ -74,7 +74,7 @@ RSpec.describe PostReceive do
...
@@ -74,7 +74,7 @@ RSpec.describe PostReceive do
let
(
:empty_project
)
{
create
(
:project
,
:empty_repo
)
}
let
(
:empty_project
)
{
create
(
:project
,
:empty_repo
)
}
before
do
before
do
allow_next
(
Gitlab
::
GitPostReceive
).
to
receive
(
:identify
).
and_return
(
empty_project
.
owner
)
allow_next
(
Gitlab
::
GitPostReceive
).
to
receive
(
:identify
).
and_return
(
empty_project
.
first_
owner
)
# Need to mock here so we can expect calls on project
# Need to mock here so we can expect calls on project
allow
(
Gitlab
::
GlRepository
).
to
receive
(
:parse
).
and_return
([
empty_project
,
empty_project
,
Gitlab
::
GlRepository
::
PROJECT
])
allow
(
Gitlab
::
GlRepository
).
to
receive
(
:parse
).
and_return
([
empty_project
,
empty_project
,
Gitlab
::
GlRepository
::
PROJECT
])
end
end
...
@@ -128,7 +128,7 @@ RSpec.describe PostReceive do
...
@@ -128,7 +128,7 @@ RSpec.describe PostReceive do
let
(
:push_service
)
{
double
(
execute:
true
)
}
let
(
:push_service
)
{
double
(
execute:
true
)
}
before
do
before
do
allow_next
(
Gitlab
::
GitPostReceive
).
to
receive
(
:identify
).
and_return
(
project
.
owner
)
allow_next
(
Gitlab
::
GitPostReceive
).
to
receive
(
:identify
).
and_return
(
project
.
first_
owner
)
allow
(
Gitlab
::
GlRepository
).
to
receive
(
:parse
).
and_return
([
project
,
project
,
Gitlab
::
GlRepository
::
PROJECT
])
allow
(
Gitlab
::
GlRepository
).
to
receive
(
:parse
).
and_return
([
project
,
project
,
Gitlab
::
GlRepository
::
PROJECT
])
end
end
...
@@ -381,7 +381,7 @@ RSpec.describe PostReceive do
...
@@ -381,7 +381,7 @@ RSpec.describe PostReceive do
allow
(
Project
).
to
receive
(
:find_by
).
and_return
(
project
)
allow
(
Project
).
to
receive
(
:find_by
).
and_return
(
project
)
expect_next
(
MergeRequests
::
PushedBranchesService
).
to
receive
(
:execute
).
and_return
(
%w(tést)
)
expect_next
(
MergeRequests
::
PushedBranchesService
).
to
receive
(
:execute
).
and_return
(
%w(tést)
)
expect
(
UpdateMergeRequestsWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
project
.
owner
.
id
,
any_args
)
expect
(
UpdateMergeRequestsWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
project
.
first_
owner
.
id
,
any_args
)
perform
perform
end
end
...
@@ -461,13 +461,13 @@ RSpec.describe PostReceive do
...
@@ -461,13 +461,13 @@ RSpec.describe PostReceive do
end
end
context
'with PersonalSnippet'
do
context
'with PersonalSnippet'
do
let!
(
:snippet
)
{
create
(
:personal_snippet
,
:repository
,
author:
project
.
owner
)
}
let!
(
:snippet
)
{
create
(
:personal_snippet
,
:repository
,
author:
project
.
first_
owner
)
}
it_behaves_like
'snippet changes actions'
it_behaves_like
'snippet changes actions'
end
end
context
'with ProjectSnippet'
do
context
'with ProjectSnippet'
do
let!
(
:snippet
)
{
create
(
:project_snippet
,
:repository
,
project:
project
,
author:
project
.
owner
)
}
let!
(
:snippet
)
{
create
(
:project_snippet
,
:repository
,
project:
project
,
author:
project
.
first_
owner
)
}
it_behaves_like
'snippet changes actions'
it_behaves_like
'snippet changes actions'
end
end
...
...
spec/workers/project_destroy_worker_spec.rb
View file @
ef688d84
...
@@ -14,7 +14,7 @@ RSpec.describe ProjectDestroyWorker do
...
@@ -14,7 +14,7 @@ RSpec.describe ProjectDestroyWorker do
describe
'#perform'
do
describe
'#perform'
do
it
'deletes the project'
do
it
'deletes the project'
do
subject
.
perform
(
project
.
id
,
project
.
owner
.
id
,
{})
subject
.
perform
(
project
.
id
,
project
.
first_
owner
.
id
,
{})
expect
(
Project
.
all
).
not_to
include
(
project
)
expect
(
Project
.
all
).
not_to
include
(
project
)
expect
(
Dir
.
exist?
(
path
)).
to
be_falsey
expect
(
Dir
.
exist?
(
path
)).
to
be_falsey
...
@@ -22,7 +22,7 @@ RSpec.describe ProjectDestroyWorker do
...
@@ -22,7 +22,7 @@ RSpec.describe ProjectDestroyWorker do
it
'does not raise error when project could not be found'
do
it
'does not raise error when project could not be found'
do
expect
do
expect
do
subject
.
perform
(
-
1
,
project
.
owner
.
id
,
{})
subject
.
perform
(
-
1
,
project
.
first_
owner
.
id
,
{})
end
.
not_to
raise_error
end
.
not_to
raise_error
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