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
08f87e4d
Commit
08f87e4d
authored
Oct 14, 2020
by
Matthew Briedenhann
Committed by
Peter Leitzen
Oct 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rails/SaveBang offenses
Added bangs in spec/services/projects/*
parent
12c9839c
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
34 additions
and
42 deletions
+34
-42
.rubocop_todo.yml
.rubocop_todo.yml
+0
-13
changelogs/unreleased/mb_rails_save_bang_fix4.yml
changelogs/unreleased/mb_rails_save_bang_fix4.yml
+5
-0
spec/services/projects/after_rename_service_spec.rb
spec/services/projects/after_rename_service_spec.rb
+1
-1
spec/services/projects/autocomplete_service_spec.rb
spec/services/projects/autocomplete_service_spec.rb
+1
-1
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+1
-1
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+1
-1
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+2
-2
spec/services/projects/hashed_storage/base_attachment_service_spec.rb
...s/projects/hashed_storage/base_attachment_service_spec.rb
+1
-1
spec/services/projects/move_access_service_spec.rb
spec/services/projects/move_access_service_spec.rb
+4
-4
spec/services/projects/move_project_group_links_service_spec.rb
...ervices/projects/move_project_group_links_service_spec.rb
+7
-7
spec/services/projects/overwrite_project_service_spec.rb
spec/services/projects/overwrite_project_service_spec.rb
+3
-3
spec/services/projects/unlink_fork_service_spec.rb
spec/services/projects/unlink_fork_service_spec.rb
+1
-1
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+3
-3
spec/services/projects/update_service_spec.rb
spec/services/projects/update_service_spec.rb
+4
-4
No files found.
.rubocop_todo.yml
View file @
08f87e4d
...
...
@@ -1141,19 +1141,6 @@ Rails/SaveBang:
-
'
spec/services/notification_recipients/build_service_spec.rb'
-
'
spec/services/notification_service_spec.rb'
-
'
spec/services/packages/conan/create_package_file_service_spec.rb'
-
'
spec/services/projects/after_rename_service_spec.rb'
-
'
spec/services/projects/autocomplete_service_spec.rb'
-
'
spec/services/projects/create_service_spec.rb'
-
'
spec/services/projects/destroy_service_spec.rb'
-
'
spec/services/projects/fork_service_spec.rb'
-
'
spec/services/projects/hashed_storage/base_attachment_service_spec.rb'
-
'
spec/services/projects/move_access_service_spec.rb'
-
'
spec/services/projects/move_project_group_links_service_spec.rb'
-
'
spec/services/projects/overwrite_project_service_spec.rb'
-
'
spec/services/projects/propagate_service_template_spec.rb'
-
'
spec/services/projects/unlink_fork_service_spec.rb'
-
'
spec/services/projects/update_pages_service_spec.rb'
-
'
spec/services/projects/update_service_spec.rb'
-
'
spec/services/reset_project_cache_service_spec.rb'
-
'
spec/services/resource_events/change_milestone_service_spec.rb'
-
'
spec/services/system_hooks_service_spec.rb'
...
...
changelogs/unreleased/mb_rails_save_bang_fix4.yml
0 → 100644
View file @
08f87e4d
---
title
:
Fix Rails/SaveBang offenses in spec/services/projects/*
merge_request
:
44980
author
:
matthewbried
type
:
other
spec/services/projects/after_rename_service_spec.rb
View file @
08f87e4d
...
...
@@ -243,7 +243,7 @@ RSpec.describe Projects::AfterRenameService do
def
service_execute
# AfterRenameService is called by UpdateService after a successful model.update
# the initialization will include before and after paths values
project
.
update
(
path:
path_after_rename
)
project
.
update
!
(
path:
path_after_rename
)
described_class
.
new
(
project
,
path_before:
path_before_rename
,
full_path_before:
full_path_before_rename
).
execute
end
...
...
spec/services/projects/autocomplete_service_spec.rb
View file @
08f87e4d
...
...
@@ -123,7 +123,7 @@ RSpec.describe Projects::AutocompleteService do
let!
(
:subgroup_milestone
)
{
create
(
:milestone
,
group:
subgroup
)
}
before
do
project
.
update
(
namespace:
subgroup
)
project
.
update
!
(
namespace:
subgroup
)
end
it
'includes project milestones and all acestors milestones'
do
...
...
spec/services/projects/create_service_spec.rb
View file @
08f87e4d
...
...
@@ -15,7 +15,7 @@ RSpec.describe Projects::CreateService, '#execute' do
end
it
'creates labels on Project creation if there are templates'
do
Label
.
create
(
title:
"bug"
,
template:
true
)
Label
.
create
!
(
title:
"bug"
,
template:
true
)
project
=
create_project
(
user
,
opts
)
created_label
=
project
.
reload
.
labels
.
last
...
...
spec/services/projects/destroy_service_spec.rb
View file @
08f87e4d
...
...
@@ -72,7 +72,7 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
context
'when project has remote mirrors'
do
let!
(
:project
)
do
create
(
:project
,
:repository
,
namespace:
user
.
namespace
).
tap
do
|
project
|
project
.
remote_mirrors
.
create
(
url:
'http://test.com'
)
project
.
remote_mirrors
.
create
!
(
url:
'http://test.com'
)
end
end
...
...
spec/services/projects/fork_service_spec.rb
View file @
08f87e4d
...
...
@@ -179,7 +179,7 @@ RSpec.describe Projects::ForkService do
context
"when origin has git depth specified"
do
before
do
@from_project
.
update
(
ci_default_git_depth:
42
)
@from_project
.
update
!
(
ci_default_git_depth:
42
)
end
it
"inherits default_git_depth from the origin project"
do
...
...
@@ -201,7 +201,7 @@ RSpec.describe Projects::ForkService do
context
"when project has restricted visibility level"
do
context
"and only one visibility level is restricted"
do
before
do
@from_project
.
update
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
@from_project
.
update
!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
INTERNAL
])
end
...
...
spec/services/projects/hashed_storage/base_attachment_service_spec.rb
View file @
08f87e4d
...
...
@@ -45,7 +45,7 @@ RSpec.describe Projects::HashedStorage::BaseAttachmentService do
describe
'#move_folder!'
do
context
'when old_path is not a directory'
do
it
'adds information to the logger and returns true'
do
Tempfile
.
create
do
|
old_path
|
Tempfile
.
create
do
|
old_path
|
# rubocop:disable Rails/SaveBang
new_path
=
"
#{
old_path
}
-new"
expect
(
subject
.
send
(
:move_folder!
,
old_path
,
new_path
)).
to
be_truthy
...
...
spec/services/projects/move_access_service_spec.rb
View file @
08f87e4d
...
...
@@ -17,9 +17,9 @@ RSpec.describe Projects::MoveAccessService do
project_with_access
.
add_maintainer
(
maintainer_user
)
project_with_access
.
add_developer
(
developer_user
)
project_with_access
.
add_reporter
(
reporter_user
)
project_with_access
.
project_group_links
.
create
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
project_with_access
.
project_group_links
.
create
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
project_with_access
.
project_group_links
.
create
(
group:
reporter_group
,
group_access:
Gitlab
::
Access
::
REPORTER
)
project_with_access
.
project_group_links
.
create
!
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
project_with_access
.
project_group_links
.
create
!
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
project_with_access
.
project_group_links
.
create
!
(
group:
reporter_group
,
group_access:
Gitlab
::
Access
::
REPORTER
)
end
subject
{
described_class
.
new
(
target_project
,
user
)
}
...
...
@@ -97,7 +97,7 @@ RSpec.describe Projects::MoveAccessService do
end
it
'does not remove remaining group links'
do
target_project
.
project_group_links
.
create
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
target_project
.
project_group_links
.
create
!
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
subject
.
execute
(
project_with_access
,
options
)
...
...
spec/services/projects/move_project_group_links_service_spec.rb
View file @
08f87e4d
...
...
@@ -14,9 +14,9 @@ RSpec.describe Projects::MoveProjectGroupLinksService do
describe
'#execute'
do
before
do
project_with_groups
.
project_group_links
.
create
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
project_with_groups
.
project_group_links
.
create
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
project_with_groups
.
project_group_links
.
create
(
group:
reporter_group
,
group_access:
Gitlab
::
Access
::
REPORTER
)
project_with_groups
.
project_group_links
.
create
!
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
project_with_groups
.
project_group_links
.
create
!
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
project_with_groups
.
project_group_links
.
create
!
(
group:
reporter_group
,
group_access:
Gitlab
::
Access
::
REPORTER
)
end
it
'moves the group links from one project to another'
do
...
...
@@ -30,8 +30,8 @@ RSpec.describe Projects::MoveProjectGroupLinksService do
end
it
'does not move existent group links in the current project'
do
target_project
.
project_group_links
.
create
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
target_project
.
project_group_links
.
create
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
target_project
.
project_group_links
.
create
!
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
target_project
.
project_group_links
.
create
!
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
expect
(
project_with_groups
.
project_group_links
.
count
).
to
eq
3
expect
(
target_project
.
project_group_links
.
count
).
to
eq
2
...
...
@@ -55,8 +55,8 @@ RSpec.describe Projects::MoveProjectGroupLinksService do
let
(
:options
)
{
{
remove_remaining_elements:
false
}
}
it
'does not remove remaining project group links'
do
target_project
.
project_group_links
.
create
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
target_project
.
project_group_links
.
create
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
target_project
.
project_group_links
.
create
!
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
target_project
.
project_group_links
.
create
!
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
subject
.
execute
(
project_with_groups
,
options
)
...
...
spec/services/projects/overwrite_project_service_spec.rb
View file @
08f87e4d
...
...
@@ -111,9 +111,9 @@ RSpec.describe Projects::OverwriteProjectService do
create_list
(
:deploy_keys_project
,
2
,
project:
project_from
)
create_list
(
:notification_setting
,
2
,
source:
project_from
)
create_list
(
:users_star_project
,
2
,
project:
project_from
)
project_from
.
project_group_links
.
create
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
project_from
.
project_group_links
.
create
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
project_from
.
project_group_links
.
create
(
group:
reporter_group
,
group_access:
Gitlab
::
Access
::
REPORTER
)
project_from
.
project_group_links
.
create
!
(
group:
maintainer_group
,
group_access:
Gitlab
::
Access
::
MAINTAINER
)
project_from
.
project_group_links
.
create
!
(
group:
developer_group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
project_from
.
project_group_links
.
create
!
(
group:
reporter_group
,
group_access:
Gitlab
::
Access
::
REPORTER
)
project_from
.
add_maintainer
(
maintainer_user
)
project_from
.
add_developer
(
developer_user
)
project_from
.
add_reporter
(
reporter_user
)
...
...
spec/services/projects/unlink_fork_service_spec.rb
View file @
08f87e4d
...
...
@@ -61,7 +61,7 @@ RSpec.describe Projects::UnlinkForkService, :use_clean_rails_memory_store_cachin
context
'when the original project was deleted'
do
it
'does not fail when the original project is deleted'
do
source
=
forked_project
.
forked_from_project
source
.
destroy
source
.
destroy
!
forked_project
.
reload
expect
{
subject
.
execute
}.
not_to
raise_error
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
08f87e4d
...
...
@@ -95,14 +95,14 @@ RSpec.describe Projects::UpdatePagesService do
expect
(
project
.
pages_deployed?
).
to
be_truthy
expect
(
Dir
.
exist?
(
File
.
join
(
project
.
pages_path
))).
to
be_truthy
project
.
destroy
project
.
destroy
!
expect
(
Dir
.
exist?
(
File
.
join
(
project
.
pages_path
))).
to
be_falsey
expect
(
ProjectPagesMetadatum
.
find_by_project_id
(
project
)).
to
be_nil
end
it
'fails if sha on branch is not latest'
do
build
.
update
(
ref:
'feature'
)
build
.
update
!
(
ref:
'feature'
)
expect
(
execute
).
not_to
eq
(
:success
)
expect
(
project
.
pages_metadatum
).
not_to
be_deployed
...
...
@@ -191,7 +191,7 @@ RSpec.describe Projects::UpdatePagesService do
it
'fails to remove project pages when no pages is deployed'
do
expect
(
PagesWorker
).
not_to
receive
(
:perform_in
)
expect
(
project
.
pages_deployed?
).
to
be_falsey
project
.
destroy
project
.
destroy
!
end
it
'fails if no artifacts'
do
...
...
spec/services/projects/update_service_spec.rb
View file @
08f87e4d
...
...
@@ -141,7 +141,7 @@ RSpec.describe Projects::UpdateService do
let
(
:group
)
{
create
(
:group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
before
do
project
.
update
(
namespace:
group
,
visibility_level:
group
.
visibility_level
)
project
.
update
!
(
namespace:
group
,
visibility_level:
group
.
visibility_level
)
end
it
'does not update project visibility level'
do
...
...
@@ -256,7 +256,7 @@ RSpec.describe Projects::UpdateService do
end
it
'handles empty project feature attributes'
do
project
.
project_feature
.
update
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
project
.
project_feature
.
update
!
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
result
=
update_project
(
project
,
user
,
{
name:
'test1'
})
...
...
@@ -267,7 +267,7 @@ RSpec.describe Projects::UpdateService do
context
'when enabling a wiki'
do
it
'creates a wiki'
do
project
.
project_feature
.
update
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
project
.
project_feature
.
update
!
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
TestEnv
.
rm_storage_dir
(
project
.
repository_storage
,
project
.
wiki
.
path
)
result
=
update_project
(
project
,
user
,
project_feature_attributes:
{
wiki_access_level:
ProjectFeature
::
ENABLED
})
...
...
@@ -278,7 +278,7 @@ RSpec.describe Projects::UpdateService do
end
it
'logs an error and creates a metric when wiki can not be created'
do
project
.
project_feature
.
update
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
project
.
project_feature
.
update
!
(
wiki_access_level:
ProjectFeature
::
DISABLED
)
expect_any_instance_of
(
ProjectWiki
).
to
receive
(
:wiki
).
and_raise
(
Wiki
::
CouldNotCreateWikiError
)
expect_any_instance_of
(
described_class
).
to
receive
(
:log_error
).
with
(
"Could not create wiki for
#{
project
.
full_name
}
"
)
...
...
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