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
a21167da
Commit
a21167da
authored
Jul 27, 2020
by
Rajendra Kadam
Committed by
Peter Leitzen
Jul 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rails/SaveBang RuboCop offenses for all `spec/helpers/*` and `ee/spec/helpers/*`
parent
4dbadb17
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
29 additions
and
36 deletions
+29
-36
.rubocop_todo.yml
.rubocop_todo.yml
+0
-13
changelogs/unreleased/rails-save-bang-5.yml
changelogs/unreleased/rails-save-bang-5.yml
+5
-0
ee/spec/helpers/application_helper_spec.rb
ee/spec/helpers/application_helper_spec.rb
+1
-1
ee/spec/helpers/ee/dashboard_helper_spec.rb
ee/spec/helpers/ee/dashboard_helper_spec.rb
+1
-1
ee/spec/helpers/ee/issues_helper_spec.rb
ee/spec/helpers/ee/issues_helper_spec.rb
+1
-1
spec/helpers/appearances_helper_spec.rb
spec/helpers/appearances_helper_spec.rb
+1
-1
spec/helpers/auto_devops_helper_spec.rb
spec/helpers/auto_devops_helper_spec.rb
+1
-1
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+1
-1
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+4
-4
spec/helpers/members_helper_spec.rb
spec/helpers/members_helper_spec.rb
+1
-1
spec/helpers/notes_helper_spec.rb
spec/helpers/notes_helper_spec.rb
+3
-3
spec/helpers/profiles_helper_spec.rb
spec/helpers/profiles_helper_spec.rb
+1
-1
spec/helpers/projects/alert_management_helper_spec.rb
spec/helpers/projects/alert_management_helper_spec.rb
+1
-1
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+4
-4
spec/helpers/visibility_level_helper_spec.rb
spec/helpers/visibility_level_helper_spec.rb
+4
-3
No files found.
.rubocop_todo.yml
View file @
a21167da
...
@@ -1273,9 +1273,6 @@ Rails/SaveBang:
...
@@ -1273,9 +1273,6 @@ Rails/SaveBang:
-
'
ee/spec/finders/security/vulnerabilities_finder_spec.rb'
-
'
ee/spec/finders/security/vulnerabilities_finder_spec.rb'
-
'
ee/spec/frontend/fixtures/analytics.rb'
-
'
ee/spec/frontend/fixtures/analytics.rb'
-
'
ee/spec/graphql/resolvers/vulnerabilities_resolver_spec.rb'
-
'
ee/spec/graphql/resolvers/vulnerabilities_resolver_spec.rb'
-
'
ee/spec/helpers/application_helper_spec.rb'
-
'
ee/spec/helpers/ee/dashboard_helper_spec.rb'
-
'
ee/spec/helpers/ee/issues_helper_spec.rb'
-
'
ee/spec/initializers/fog_google_https_private_urls_spec.rb'
-
'
ee/spec/initializers/fog_google_https_private_urls_spec.rb'
-
'
ee/spec/lib/analytics/merge_request_metrics_calculator_spec.rb'
-
'
ee/spec/lib/analytics/merge_request_metrics_calculator_spec.rb'
-
'
ee/spec/lib/ee/gitlab/auth/ldap/sync/group_spec.rb'
-
'
ee/spec/lib/ee/gitlab/auth/ldap/sync/group_spec.rb'
...
@@ -1571,16 +1568,6 @@ Rails/SaveBang:
...
@@ -1571,16 +1568,6 @@ Rails/SaveBang:
-
'
spec/graphql/mutations/merge_requests/set_locked_spec.rb'
-
'
spec/graphql/mutations/merge_requests/set_locked_spec.rb'
-
'
spec/graphql/mutations/merge_requests/set_wip_spec.rb'
-
'
spec/graphql/mutations/merge_requests/set_wip_spec.rb'
-
'
spec/graphql/resolvers/boards_resolver_spec.rb'
-
'
spec/graphql/resolvers/boards_resolver_spec.rb'
-
'
spec/helpers/appearances_helper_spec.rb'
-
'
spec/helpers/auto_devops_helper_spec.rb'
-
'
spec/helpers/issuables_helper_spec.rb'
-
'
spec/helpers/issues_helper_spec.rb'
-
'
spec/helpers/members_helper_spec.rb'
-
'
spec/helpers/notes_helper_spec.rb'
-
'
spec/helpers/profiles_helper_spec.rb'
-
'
spec/helpers/projects/alert_management_helper_spec.rb'
-
'
spec/helpers/projects_helper_spec.rb'
-
'
spec/helpers/visibility_level_helper_spec.rb'
-
'
spec/initializers/active_record_locking_spec.rb'
-
'
spec/initializers/active_record_locking_spec.rb'
-
'
spec/initializers/fog_google_https_private_urls_spec.rb'
-
'
spec/initializers/fog_google_https_private_urls_spec.rb'
-
'
spec/lib/after_commit_queue_spec.rb'
-
'
spec/lib/after_commit_queue_spec.rb'
...
...
changelogs/unreleased/rails-save-bang-5.yml
0 → 100644
View file @
a21167da
---
title
:
Refactor spec/helpers and ee/spec/helpers to fix SaveBang Cop
merge_request
:
37446
author
:
Rajendra Kadam
type
:
fixed
ee/spec/helpers/application_helper_spec.rb
View file @
a21167da
...
@@ -125,7 +125,7 @@ RSpec.describe ApplicationHelper do
...
@@ -125,7 +125,7 @@ RSpec.describe ApplicationHelper do
end
end
it
'returns paths for autocomplete_sources_controller including epics for group projects'
do
it
'returns paths for autocomplete_sources_controller including epics for group projects'
do
object
.
update
(
group:
create
(
:group
))
object
.
update
!
(
group:
create
(
:group
))
expect_autocomplete_data_sources
(
object
,
noteable_type
,
[
:members
,
:issues
,
:mergeRequests
,
:labels
,
:milestones
,
:commands
,
:snippets
,
:epics
])
expect_autocomplete_data_sources
(
object
,
noteable_type
,
[
:members
,
:issues
,
:mergeRequests
,
:labels
,
:milestones
,
:commands
,
:snippets
,
:epics
])
end
end
...
...
ee/spec/helpers/ee/dashboard_helper_spec.rb
View file @
a21167da
...
@@ -185,7 +185,7 @@ RSpec.describe DashboardHelper, type: :helper do
...
@@ -185,7 +185,7 @@ RSpec.describe DashboardHelper, type: :helper do
end
end
with_them
do
with_them
do
let
(
:user
)
{
create
(
current_user
)
}
let
(
:user
)
{
create
(
current_user
)
}
# rubocop:disable Rails/SaveBang
let
(
:license
)
{
has_license
&&
create
(
:license
)
}
let
(
:license
)
{
has_license
&&
create
(
:license
)
}
subject
{
helper
.
has_start_trial?
}
subject
{
helper
.
has_start_trial?
}
...
...
ee/spec/helpers/ee/issues_helper_spec.rb
View file @
a21167da
...
@@ -13,7 +13,7 @@ RSpec.describe EE::IssuesHelper do
...
@@ -13,7 +13,7 @@ RSpec.describe EE::IssuesHelper do
context
'with linked issue'
do
context
'with linked issue'
do
context
'with promoted issue'
do
context
'with promoted issue'
do
before
do
before
do
issue
.
update
(
promoted_to_epic:
new_epic
)
issue
.
update
!
(
promoted_to_epic:
new_epic
)
end
end
context
'when user has permission to see new epic'
do
context
'when user has permission to see new epic'
do
...
...
spec/helpers/appearances_helper_spec.rb
View file @
a21167da
...
@@ -70,7 +70,7 @@ RSpec.describe AppearancesHelper do
...
@@ -70,7 +70,7 @@ RSpec.describe AppearancesHelper do
context
'when there is a logo but no associated upload'
do
context
'when there is a logo but no associated upload'
do
before
do
before
do
# Legacy attachments were not tracked in the uploads table
# Legacy attachments were not tracked in the uploads table
appearance
.
logo
.
upload
.
destroy
appearance
.
logo
.
upload
.
destroy
!
appearance
.
reload
appearance
.
reload
end
end
...
...
spec/helpers/auto_devops_helper_spec.rb
View file @
a21167da
...
@@ -128,7 +128,7 @@ RSpec.describe AutoDevopsHelper do
...
@@ -128,7 +128,7 @@ RSpec.describe AutoDevopsHelper do
context
'with groups'
do
context
'with groups'
do
before
do
before
do
receiver
.
update
(
parent:
parent
)
receiver
.
update
!
(
parent:
parent
)
end
end
context
'when auto devops is enabled on parent'
do
context
'when auto devops is enabled on parent'
do
...
...
spec/helpers/issuables_helper_spec.rb
View file @
a21167da
...
@@ -160,7 +160,7 @@ RSpec.describe IssuablesHelper do
...
@@ -160,7 +160,7 @@ RSpec.describe IssuablesHelper do
end
end
before
do
before
do
user
.
destroy
user
.
destroy
!
end
end
it
'returns "Ghost user" as edited_by'
do
it
'returns "Ghost user" as edited_by'
do
...
...
spec/helpers/issues_helper_spec.rb
View file @
a21167da
...
@@ -162,7 +162,7 @@ RSpec.describe IssuesHelper do
...
@@ -162,7 +162,7 @@ RSpec.describe IssuesHelper do
context
'with linked issue'
do
context
'with linked issue'
do
context
'with moved issue'
do
context
'with moved issue'
do
before
do
before
do
issue
.
update
(
moved_to:
new_issue
)
issue
.
update
!
(
moved_to:
new_issue
)
end
end
context
'when user has permission to see new issue'
do
context
'when user has permission to see new issue'
do
...
@@ -181,7 +181,7 @@ RSpec.describe IssuesHelper do
...
@@ -181,7 +181,7 @@ RSpec.describe IssuesHelper do
context
'with duplicated issue'
do
context
'with duplicated issue'
do
before
do
before
do
issue
.
update
(
duplicated_to:
new_issue
)
issue
.
update
!
(
duplicated_to:
new_issue
)
end
end
context
'when user has permission to see new issue'
do
context
'when user has permission to see new issue'
do
...
@@ -203,7 +203,7 @@ RSpec.describe IssuesHelper do
...
@@ -203,7 +203,7 @@ RSpec.describe IssuesHelper do
let
(
:user
)
{
project
.
owner
}
let
(
:user
)
{
project
.
owner
}
before
do
before
do
issue
.
update
(
moved_to:
nil
,
duplicated_to:
nil
)
issue
.
update
!
(
moved_to:
nil
,
duplicated_to:
nil
)
end
end
it_behaves_like
'does not display link'
it_behaves_like
'does not display link'
...
@@ -220,7 +220,7 @@ RSpec.describe IssuesHelper do
...
@@ -220,7 +220,7 @@ RSpec.describe IssuesHelper do
allow
(
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
IncomingEmail
).
to
receive
(
:supports_wildcard?
)
{
true
}
allow
(
Gitlab
::
IncomingEmail
).
to
receive
(
:supports_wildcard?
)
{
true
}
old_issue
.
update
(
moved_to:
new_issue
)
old_issue
.
update
!
(
moved_to:
new_issue
)
end
end
it
'is true when moved issue project has service desk disabled'
do
it
'is true when moved issue project has service desk disabled'
do
...
...
spec/helpers/members_helper_spec.rb
View file @
a21167da
...
@@ -25,7 +25,7 @@ RSpec.describe MembersHelper do
...
@@ -25,7 +25,7 @@ RSpec.describe MembersHelper do
context
'an accepted user invitation with no user associated'
do
context
'an accepted user invitation with no user associated'
do
before
do
before
do
group_member_invite
.
update
(
invite_email:
"
#{
SecureRandom
.
hex
}
@example.com"
,
invite_token:
nil
,
user_id:
nil
)
group_member_invite
.
update
_columns
(
invite_email:
"
#{
SecureRandom
.
hex
}
@example.com"
,
invite_token:
nil
,
user_id:
nil
)
end
end
it
'logs an exception and shows orphaned status'
do
it
'logs an exception and shows orphaned status'
do
...
...
spec/helpers/notes_helper_spec.rb
View file @
a21167da
...
@@ -77,9 +77,9 @@ RSpec.describe NotesHelper do
...
@@ -77,9 +77,9 @@ RSpec.describe NotesHelper do
context
'for a merge request discusion'
do
context
'for a merge request discusion'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
importing:
true
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
importing:
true
)
}
let!
(
:merge_request_diff1
)
{
merge_request
.
merge_request_diffs
.
create
(
head_commit_sha:
'6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
)
}
let!
(
:merge_request_diff1
)
{
merge_request
.
merge_request_diffs
.
create
!
(
head_commit_sha:
'6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
)
}
let!
(
:merge_request_diff2
)
{
merge_request
.
merge_request_diffs
.
create
(
head_commit_sha:
nil
)
}
let!
(
:merge_request_diff2
)
{
merge_request
.
merge_request_diffs
.
create
!
(
head_commit_sha:
nil
)
}
let!
(
:merge_request_diff3
)
{
merge_request
.
merge_request_diffs
.
create
(
head_commit_sha:
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
}
let!
(
:merge_request_diff3
)
{
merge_request
.
merge_request_diffs
.
create
!
(
head_commit_sha:
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
}
context
'for a diff discussion'
do
context
'for a diff discussion'
do
context
'when the discussion is active'
do
context
'when the discussion is active'
do
...
...
spec/helpers/profiles_helper_spec.rb
View file @
a21167da
...
@@ -31,7 +31,7 @@ RSpec.describe ProfilesHelper do
...
@@ -31,7 +31,7 @@ RSpec.describe ProfilesHelper do
end
end
it
'returns DB stored commit_email'
do
it
'returns DB stored commit_email'
do
user
.
update
(
commit_email:
Gitlab
::
PrivateCommitEmail
::
TOKEN
)
user
.
update
!
(
commit_email:
Gitlab
::
PrivateCommitEmail
::
TOKEN
)
expect
(
helper
.
selected_commit_email
(
user
)).
to
eq
(
Gitlab
::
PrivateCommitEmail
::
TOKEN
)
expect
(
helper
.
selected_commit_email
(
user
)).
to
eq
(
Gitlab
::
PrivateCommitEmail
::
TOKEN
)
end
end
...
...
spec/helpers/projects/alert_management_helper_spec.rb
View file @
a21167da
...
@@ -49,7 +49,7 @@ RSpec.describe Projects::AlertManagementHelper do
...
@@ -49,7 +49,7 @@ RSpec.describe Projects::AlertManagementHelper do
context
'when alerts service is inactive'
do
context
'when alerts service is inactive'
do
it
'disables alert management'
do
it
'disables alert management'
do
alerts_service
.
update
(
active:
false
)
alerts_service
.
update
!
(
active:
false
)
expect
(
data
).
to
include
(
expect
(
data
).
to
include
(
'alert-management-enabled'
=>
'false'
'alert-management-enabled'
=>
'false'
...
...
spec/helpers/projects_helper_spec.rb
View file @
a21167da
...
@@ -126,7 +126,7 @@ RSpec.describe ProjectsHelper do
...
@@ -126,7 +126,7 @@ RSpec.describe ProjectsHelper do
it
"returns false if there are permissions and origin project is PRIVATE"
do
it
"returns false if there are permissions and origin project is PRIVATE"
do
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
project
.
update
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
project
.
update
!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
helper
.
can_change_visibility_level?
(
forked_project
,
user
)).
to
be_falsey
expect
(
helper
.
can_change_visibility_level?
(
forked_project
,
user
)).
to
be_falsey
end
end
...
@@ -134,7 +134,7 @@ RSpec.describe ProjectsHelper do
...
@@ -134,7 +134,7 @@ RSpec.describe ProjectsHelper do
it
"returns true if there are permissions and origin project is INTERNAL"
do
it
"returns true if there are permissions and origin project is INTERNAL"
do
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
project
.
update
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
project
.
update
!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
expect
(
helper
.
can_change_visibility_level?
(
forked_project
,
user
)).
to
be_truthy
expect
(
helper
.
can_change_visibility_level?
(
forked_project
,
user
)).
to
be_truthy
end
end
...
@@ -647,7 +647,7 @@ RSpec.describe ProjectsHelper do
...
@@ -647,7 +647,7 @@ RSpec.describe ProjectsHelper do
context
'user has a configured commit email'
do
context
'user has a configured commit email'
do
before
do
before
do
confirmed_email
=
create
(
:email
,
:confirmed
,
user:
user
)
confirmed_email
=
create
(
:email
,
:confirmed
,
user:
user
)
user
.
update
(
commit_email:
confirmed_email
)
user
.
update
!
(
commit_email:
confirmed_email
)
end
end
it
'returns the commit email'
do
it
'returns the commit email'
do
...
@@ -866,7 +866,7 @@ RSpec.describe ProjectsHelper do
...
@@ -866,7 +866,7 @@ RSpec.describe ProjectsHelper do
when
:developer
,
:maintainer
when
:developer
,
:maintainer
project
.
add_user
(
user
,
access
)
project
.
add_user
(
user
,
access
)
when
:owner
when
:owner
project
.
namespace
.
update
(
owner:
user
)
project
.
namespace
.
update
!
(
owner:
user
)
end
end
end
end
...
...
spec/helpers/visibility_level_helper_spec.rb
View file @
a21167da
...
@@ -171,13 +171,14 @@ RSpec.describe VisibilityLevelHelper do
...
@@ -171,13 +171,14 @@ RSpec.describe VisibilityLevelHelper do
with_them
do
with_them
do
it
"provides correct visibility level for forked project"
do
it
"provides correct visibility level for forked project"
do
project
.
update
(
visibility_level:
max_allowed
)
project
.
update
!
(
visibility_level:
max_allowed
)
expect
(
selected_visibility_level
(
forked_project
,
requested_level
)).
to
eq
(
expected
)
expect
(
selected_visibility_level
(
forked_project
,
requested_level
)).
to
eq
(
expected
)
end
end
it
"provides correct visibiility level for project in group"
do
it
"provides correct visibility level for project in group"
do
project
.
group
.
update
(
visibility_level:
max_allowed
)
project
.
update!
(
visibility_level:
max_allowed
)
project
.
group
.
update!
(
visibility_level:
max_allowed
)
expect
(
selected_visibility_level
(
project
,
requested_level
)).
to
eq
(
expected
)
expect
(
selected_visibility_level
(
project
,
requested_level
)).
to
eq
(
expected
)
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