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
0630b159
Commit
0630b159
authored
Dec 04, 2021
by
Siddharth Asthana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rails/SaveBang offenses
Changelog: other EE: true
parent
7976ea9c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
24 deletions
+15
-24
.rubocop_todo/rails/save_bang.yml
.rubocop_todo/rails/save_bang.yml
+0
-9
ee/spec/models/protected_environment_spec.rb
ee/spec/models/protected_environment_spec.rb
+1
-1
ee/spec/models/scim_identity_spec.rb
ee/spec/models/scim_identity_spec.rb
+1
-1
ee/spec/models/scim_oauth_access_token_spec.rb
ee/spec/models/scim_oauth_access_token_spec.rb
+1
-1
ee/spec/models/upload_spec.rb
ee/spec/models/upload_spec.rb
+2
-2
ee/spec/models/user_preference_spec.rb
ee/spec/models/user_preference_spec.rb
+1
-1
ee/spec/models/visible_approvable_spec.rb
ee/spec/models/visible_approvable_spec.rb
+5
-5
ee/spec/models/vulnerabilities/feedback_spec.rb
ee/spec/models/vulnerabilities/feedback_spec.rb
+1
-1
ee/spec/models/vulnerabilities/issue_link_spec.rb
ee/spec/models/vulnerabilities/issue_link_spec.rb
+3
-3
No files found.
.rubocop_todo/rails/save_bang.yml
View file @
0630b159
...
...
@@ -2,15 +2,6 @@
Rails/SaveBang
:
Exclude
:
-
ee/spec/lib/analytics/merge_request_metrics_calculator_spec.rb
-
ee/spec/models/protected_environment_spec.rb
-
ee/spec/models/repository_spec.rb
-
ee/spec/models/scim_identity_spec.rb
-
ee/spec/models/scim_oauth_access_token_spec.rb
-
ee/spec/models/upload_spec.rb
-
ee/spec/models/user_preference_spec.rb
-
ee/spec/models/visible_approvable_spec.rb
-
ee/spec/models/vulnerabilities/feedback_spec.rb
-
ee/spec/models/vulnerabilities/issue_link_spec.rb
-
spec/lib/backup/manager_spec.rb
-
spec/lib/gitlab/alerting/alert_spec.rb
-
spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb
...
...
ee/spec/models/protected_environment_spec.rb
View file @
0630b159
...
...
@@ -332,6 +332,6 @@ RSpec.describe ProtectedEnvironment do
end
def
create_deploy_access_level
(
protected_environment
,
**
opts
)
protected_environment
.
deploy_access_levels
.
create
(
**
opts
)
protected_environment
.
deploy_access_levels
.
create
!
(
**
opts
)
end
end
ee/spec/models/scim_identity_spec.rb
View file @
0630b159
...
...
@@ -49,7 +49,7 @@ RSpec.describe ScimIdentity do
user
=
create
(
:user
)
group
=
create
(
:group
)
identity
=
user
.
scim_identities
.
create
(
group:
group
,
extern_uid:
user
.
email
)
identity
=
user
.
scim_identities
.
create
!
(
group:
group
,
extern_uid:
user
.
email
)
expect
(
group
.
scim_identities
.
with_extern_uid
(
user
.
email
.
upcase
).
first
).
to
eq
identity
end
...
...
ee/spec/models/scim_oauth_access_token_spec.rb
View file @
0630b159
...
...
@@ -25,7 +25,7 @@ RSpec.describe ScimOauthAccessToken do
describe
'#token'
do
it
'generates a token on creation'
do
scim_token
=
described_class
.
create
(
group:
create
(
:group
))
scim_token
=
described_class
.
create
!
(
group:
create
(
:group
))
expect
(
scim_token
.
token
).
to
be_a
(
String
)
end
...
...
ee/spec/models/upload_spec.rb
View file @
0630b159
...
...
@@ -46,7 +46,7 @@ RSpec.describe Upload do
with_them
do
subject
(
:upload_included
)
{
described_class
.
replicables_for_current_secondary
(
upload
).
exists?
}
let
(
:model
)
{
create
(
*
model_factory
)
}
let
(
:model
)
{
create
(
*
model_factory
)
}
# rubocop:disable Rails/SaveBang
let
(
:node
)
do
create
(
:geo_node_with_selective_sync_for
,
model:
model
,
...
...
@@ -103,7 +103,7 @@ RSpec.describe Upload do
it
'logs an event to the Geo event log when bulk removal is used'
,
:sidekiq_inline
do
stub_current_geo_node
(
primary
)
expect
{
subject
.
model
.
destroy
}.
to
change
(
Geo
::
Event
.
where
(
replicable_name: :upload
,
event_name: :deleted
),
:count
).
by
(
1
)
expect
{
subject
.
model
.
destroy
!
}.
to
change
(
Geo
::
Event
.
where
(
replicable_name: :upload
,
event_name: :deleted
),
:count
).
by
(
1
)
payload
=
Geo
::
Event
.
where
(
replicable_name: :upload
,
event_name: :deleted
).
last
.
payload
...
...
ee/spec/models/user_preference_spec.rb
View file @
0630b159
...
...
@@ -7,7 +7,7 @@ RSpec.describe UserPreference do
shared_examples
'updates roadmap_epics_state'
do
|
state
|
it
'saves roadmap_epics_state in user_preference'
do
user_preference
.
update
(
roadmap_epics_state:
state
)
user_preference
.
update
!
(
roadmap_epics_state:
state
)
expect
(
user_preference
.
reload
.
roadmap_epics_state
).
to
eq
(
state
)
end
...
...
ee/spec/models/visible_approvable_spec.rb
View file @
0630b159
...
...
@@ -45,13 +45,13 @@ RSpec.describe VisibleApprovable do
let!
(
:approver
)
{
resource
.
author
}
it
'excludes author if author cannot approve'
do
project
.
update
(
merge_requests_author_approval:
false
)
project
.
update
!
(
merge_requests_author_approval:
false
)
is_expected
.
not_to
include
(
approver
)
end
it
'includes author if author is able to approve'
do
project
.
update
(
merge_requests_author_approval:
true
)
project
.
update
!
(
merge_requests_author_approval:
true
)
is_expected
.
to
include
(
approver
)
end
...
...
@@ -61,13 +61,13 @@ RSpec.describe VisibleApprovable do
let!
(
:approver
)
{
create
(
:user
,
email:
resource
.
commits
.
without_merge_commits
.
first
.
committer_email
)
}
it
'excludes the committer if committers cannot approve'
do
project
.
update
(
merge_requests_disable_committers_approval:
true
)
project
.
update
!
(
merge_requests_disable_committers_approval:
true
)
is_expected
.
not_to
include
(
approver
)
end
it
'includes the committer if committers are able to approve'
do
project
.
update
(
merge_requests_disable_committers_approval:
false
)
project
.
update
!
(
merge_requests_disable_committers_approval:
false
)
is_expected
.
to
include
(
approver
)
end
...
...
@@ -82,7 +82,7 @@ RSpec.describe VisibleApprovable do
end
it
'returns true when merge_requests_author_approval flag is turned on'
do
project
.
update
(
merge_requests_author_approval:
true
)
project
.
update
!
(
merge_requests_author_approval:
true
)
is_expected
.
to
be_truthy
end
...
...
ee/spec/models/vulnerabilities/feedback_spec.rb
View file @
0630b159
...
...
@@ -97,7 +97,7 @@ RSpec.describe Vulnerabilities::Feedback do
context
'when pipeline is assigned to feedback'
do
before
do
feedback
.
update
(
pipeline:
pipeline
)
feedback
.
update
!
(
pipeline:
pipeline
)
end
context
'when pipeline was updated less than 5 minutes ago'
do
...
...
ee/spec/models/vulnerabilities/issue_link_spec.rb
View file @
0630b159
...
...
@@ -55,7 +55,7 @@ RSpec.describe Vulnerabilities::IssueLink do
:vulnerabilities_issue_link
,
issue_id:
existing_link
.
issue_id
,
vulnerability_id:
existing_link
.
vulnerability_id
)
issue_link
.
save
(
validate:
false
)
issue_link
.
save
!
(
validate:
false
)
end
.
to
raise_error
(
ActiveRecord
::
RecordNotUnique
)
end
end
...
...
@@ -66,14 +66,14 @@ RSpec.describe Vulnerabilities::IssueLink do
it
'prevents the creation of a new "created" issue link'
do
expect
do
issue_link
=
build
(
:vulnerabilities_issue_link
,
:created
,
vulnerability:
existing_link
.
vulnerability
)
issue_link
.
save
(
validate:
false
)
issue_link
.
save
!
(
validate:
false
)
end
.
to
raise_error
(
ActiveRecord
::
RecordNotUnique
)
end
it
'allows the creation of a new "related" issue link'
do
expect
do
issue_link
=
build
(
:vulnerabilities_issue_link
,
:related
,
vulnerability:
existing_link
.
vulnerability
)
issue_link
.
save
(
validate:
false
)
issue_link
.
save
!
(
validate:
false
)
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