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
8fce7e48
Commit
8fce7e48
authored
May 05, 2020
by
Ryan Cobb
Committed by
Peter Leitzen
May 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for RSpec/LeakyConstantDeclaration
Additional fixes for RSpec/LeakyConstantDeclaration rubocop violations.
parent
15145fc8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
94 additions
and
28 deletions
+94
-28
.rubocop.yml
.rubocop.yml
+67
-1
spec/config/application_spec.rb
spec/config/application_spec.rb
+6
-6
spec/features/merge_request/user_resolves_conflicts_spec.rb
spec/features/merge_request/user_resolves_conflicts_spec.rb
+2
-2
spec/features/milestones/user_creates_milestone_spec.rb
spec/features/milestones/user_creates_milestone_spec.rb
+3
-3
spec/features/milestones/user_views_milestone_spec.rb
spec/features/milestones/user_views_milestone_spec.rb
+3
-3
spec/features/projects/branches/user_creates_branch_spec.rb
spec/features/projects/branches/user_creates_branch_spec.rb
+5
-5
spec/features/projects/commit/comments/user_edits_comments_spec.rb
...ures/projects/commit/comments/user_edits_comments_spec.rb
+3
-3
spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
...projects/settings/user_interacts_with_deploy_keys_spec.rb
+5
-5
No files found.
.rubocop.yml
View file @
8fce7e48
...
@@ -335,10 +335,76 @@ RSpec/AnyInstanceOf:
...
@@ -335,10 +335,76 @@ RSpec/AnyInstanceOf:
RSpec/ImplicitSubject
:
RSpec/ImplicitSubject
:
Enabled
:
false
Enabled
:
false
# WIP See https://gitlab.com/gitlab-org/gitlab/-/issues/211580
RSpec/LeakyConstantDeclaration
:
RSpec/LeakyConstantDeclaration
:
Enabled
:
true
Enabled
:
true
Exclude
:
Exclude
:
-
'
spec/**/*.rb'
-
'
spec/db/schema_spec.rb'
-
'
spec/graphql/gitlab_schema_spec.rb'
-
'
spec/helpers/visibility_level_helper_spec.rb'
-
'
spec/initializers/secret_token_spec.rb'
-
'
spec/lib/declarative_policy_spec.rb'
-
'
spec/lib/feature_spec.rb'
-
'
spec/lib/gitlab/background_migration/migrate_issue_trackers_sensitive_data_spec.rb'
-
'
spec/lib/gitlab/ci/build/credentials/factory_spec.rb'
-
'
spec/lib/gitlab/ci/config/entry/retry_spec.rb'
-
'
spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb'
-
'
spec/lib/gitlab/cluster/mixins/unicorn_http_server_spec.rb'
-
'
spec/lib/gitlab/config/entry/factory_spec.rb'
-
'
spec/lib/gitlab/config/entry/simplifiable_spec.rb'
-
'
spec/lib/gitlab/database/migration_helpers_spec.rb'
-
'
spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb'
-
'
spec/lib/gitlab/database/with_lock_retries_spec.rb'
-
'
spec/lib/gitlab/git/diff_collection_spec.rb'
-
'
spec/lib/gitlab/graphql/pagination/keyset/connection_spec.rb'
-
'
spec/lib/gitlab/health_checks/master_check_spec.rb'
-
'
spec/lib/gitlab/import_export/attribute_configuration_spec.rb'
-
'
spec/lib/gitlab/import_export/import_test_coverage_spec.rb'
-
'
spec/lib/gitlab/import_export/project/relation_factory_spec.rb'
-
'
spec/lib/gitlab/jira_import/issues_importer_spec.rb'
-
'
spec/lib/gitlab/no_cache_headers_spec.rb'
-
'
spec/lib/gitlab/path_regex_spec.rb'
-
'
spec/lib/gitlab/quick_actions/dsl_spec.rb'
-
'
spec/lib/gitlab/sidekiq_middleware/client_metrics_spec.rb'
-
'
spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb'
-
'
spec/lib/gitlab/sidekiq_middleware_spec.rb'
-
'
spec/lib/gitlab/view/presenter/factory_spec.rb'
-
'
spec/lib/marginalia_spec.rb'
-
'
spec/lib/omni_auth/strategies/jwt_spec.rb'
-
'
spec/lib/system_check/simple_executor_spec.rb'
-
'
spec/lib/system_check_spec.rb'
-
'
spec/mailers/notify_spec.rb'
-
'
spec/migrations/20191125114345_add_admin_mode_protected_path_spec.rb'
-
'
spec/migrations/encrypt_plaintext_attributes_on_application_settings_spec.rb'
-
'
spec/migrations/cleanup_optimistic_locking_nulls_pt2_fixed_spec.rb'
-
'
spec/models/clusters/cluster_spec.rb'
-
'
spec/models/concerns/batch_destroy_dependent_associations_spec.rb'
-
'
spec/models/concerns/blocks_json_serialization_spec.rb'
-
'
spec/models/concerns/bulk_insert_safe_spec.rb'
-
'
spec/models/concerns/bulk_insertable_associations_spec.rb'
-
'
spec/models/concerns/mentionable_spec.rb'
-
'
spec/models/concerns/reactive_caching_spec.rb'
-
'
spec/models/concerns/triggerable_hooks_spec.rb'
-
'
spec/models/repository_spec.rb'
-
'
spec/models/tree_spec.rb'
-
'
spec/policies/merge_request_policy_spec.rb'
-
'
spec/requests/api/graphql/tasks/task_completion_status_spec.rb'
-
'
spec/requests/api/statistics_spec.rb'
-
'
spec/rubocop/cop/rspec/env_assignment_spec.rb'
-
'
spec/serializers/commit_entity_spec.rb'
-
'
spec/services/ci/retry_build_service_spec.rb'
-
'
spec/services/clusters/applications/check_installation_progress_service_spec.rb'
-
'
spec/services/clusters/applications/check_uninstall_progress_service_spec.rb'
-
'
spec/services/clusters/applications/check_upgrade_progress_service_spec.rb'
-
'
spec/services/clusters/applications/ingress_modsecurity_usage_service_spec.rb'
-
'
spec/services/issues/resolve_discussions_spec.rb'
-
'
spec/services/metrics/dashboard/clone_dashboard_service_spec.rb'
-
'
spec/support/shared_contexts/spam_constants.rb'
-
'
spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb'
-
'
spec/support_specs/helpers/active_record/query_recorder_spec.rb'
-
'
spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb'
-
'
spec/uploaders/content_type_whitelist_spec.rb'
-
'
spec/uploaders/records_uploads_spec.rb'
RSpec/EmptyLineAfterHook
:
RSpec/EmptyLineAfterHook
:
Enabled
:
false
Enabled
:
false
...
...
spec/config/application_spec.rb
View file @
8fce7e48
...
@@ -5,7 +5,7 @@ require 'spec_helper'
...
@@ -5,7 +5,7 @@ require 'spec_helper'
describe
Gitlab
::
Application
do
# rubocop:disable RSpec/FilePath
describe
Gitlab
::
Application
do
# rubocop:disable RSpec/FilePath
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
FILTERED_PARAM
=
ActiveSupport
::
ParameterFilter
::
FILTERED
filtered_param
=
ActiveSupport
::
ParameterFilter
::
FILTERED
context
'when parameters are logged'
do
context
'when parameters are logged'
do
describe
'rails does not leak confidential parameters'
do
describe
'rails does not leak confidential parameters'
do
...
@@ -19,11 +19,11 @@ describe Gitlab::Application do # rubocop:disable RSpec/FilePath
...
@@ -19,11 +19,11 @@ describe Gitlab::Application do # rubocop:disable RSpec/FilePath
where
(
:input_url
,
:output_query
)
do
where
(
:input_url
,
:output_query
)
do
'/'
|
{}
'/'
|
{}
'/?safe=1'
|
{
'safe'
=>
'1'
}
'/?safe=1'
|
{
'safe'
=>
'1'
}
'/?private_token=secret'
|
{
'private_token'
=>
FILTERED_PARAM
}
'/?private_token=secret'
|
{
'private_token'
=>
filtered_param
}
'/?mixed=1&private_token=secret'
|
{
'mixed'
=>
'1'
,
'private_token'
=>
FILTERED_PARAM
}
'/?mixed=1&private_token=secret'
|
{
'mixed'
=>
'1'
,
'private_token'
=>
filtered_param
}
'/?note=secret¬eable=1&prefix_note=2'
|
{
'note'
=>
FILTERED_PARAM
,
'noteable'
=>
'1'
,
'prefix_note'
=>
'2'
}
'/?note=secret¬eable=1&prefix_note=2'
|
{
'note'
=>
filtered_param
,
'noteable'
=>
'1'
,
'prefix_note'
=>
'2'
}
'/?note[note]=secret&target_type=1'
|
{
'note'
=>
FILTERED_PARAM
,
'target_type'
=>
'1'
}
'/?note[note]=secret&target_type=1'
|
{
'note'
=>
filtered_param
,
'target_type'
=>
'1'
}
'/?safe[note]=secret&target_type=1'
|
{
'safe'
=>
{
'note'
=>
FILTERED_PARAM
},
'target_type'
=>
'1'
}
'/?safe[note]=secret&target_type=1'
|
{
'safe'
=>
{
'note'
=>
filtered_param
},
'target_type'
=>
'1'
}
end
end
with_them
do
with_them
do
...
...
spec/features/merge_request/user_resolves_conflicts_spec.rb
View file @
8fce7e48
...
@@ -183,14 +183,14 @@ describe 'Merge request > User resolves conflicts', :js do
...
@@ -183,14 +183,14 @@ describe 'Merge request > User resolves conflicts', :js do
end
end
end
end
UNRESOLVABLE_CONFLICTS
=
{
unresolvable_conflicts
=
{
'conflict-too-large'
=>
'when the conflicts contain a large file'
,
'conflict-too-large'
=>
'when the conflicts contain a large file'
,
'conflict-binary-file'
=>
'when the conflicts contain a binary file'
,
'conflict-binary-file'
=>
'when the conflicts contain a binary file'
,
'conflict-missing-side'
=>
'when the conflicts contain a file edited in one branch and deleted in another'
,
'conflict-missing-side'
=>
'when the conflicts contain a file edited in one branch and deleted in another'
,
'conflict-non-utf8'
=>
'when the conflicts contain a non-UTF-8 file'
'conflict-non-utf8'
=>
'when the conflicts contain a non-UTF-8 file'
}.
freeze
}.
freeze
UNRESOLVABLE_CONFLICTS
.
each
do
|
source_branch
,
description
|
unresolvable_conflicts
.
each
do
|
source_branch
,
description
|
context
description
do
context
description
do
let
(
:merge_request
)
{
create_merge_request
(
source_branch
)
}
let
(
:merge_request
)
{
create_merge_request
(
source_branch
)
}
...
...
spec/features/milestones/user_creates_milestone_spec.rb
View file @
8fce7e48
...
@@ -14,13 +14,13 @@ describe "User creates milestone", :js do
...
@@ -14,13 +14,13 @@ describe "User creates milestone", :js do
end
end
it
"creates milestone"
do
it
"creates milestone"
do
TITLE
=
"v2.3"
.
freeze
title
=
"v2.3"
.
freeze
fill_in
(
"Title"
,
with:
TITLE
)
fill_in
(
"Title"
,
with:
title
)
fill_in
(
"Description"
,
with:
"# Description header"
)
fill_in
(
"Description"
,
with:
"# Description header"
)
click_button
(
"Create milestone"
)
click_button
(
"Create milestone"
)
expect
(
page
).
to
have_content
(
TITLE
)
expect
(
page
).
to
have_content
(
title
)
.
and
have_content
(
"Issues"
)
.
and
have_content
(
"Issues"
)
.
and
have_header_with_correct_id_and_link
(
1
,
"Description header"
,
"description-header"
)
.
and
have_header_with_correct_id_and_link
(
1
,
"Description header"
,
"description-header"
)
...
...
spec/features/milestones/user_views_milestone_spec.rb
View file @
8fce7e48
...
@@ -14,13 +14,13 @@ describe "User views milestone" do
...
@@ -14,13 +14,13 @@ describe "User views milestone" do
end
end
it
"avoids N+1 database queries"
do
it
"avoids N+1 database queries"
do
ISSUE_PARAMS
=
{
project:
project
,
assignees:
[
user
],
author:
user
,
milestone:
milestone
,
labels:
labels
}.
freeze
issue_params
=
{
project:
project
,
assignees:
[
user
],
author:
user
,
milestone:
milestone
,
labels:
labels
}.
freeze
create
(
:labeled_issue
,
ISSUE_PARAMS
)
create
(
:labeled_issue
,
issue_params
)
control
=
ActiveRecord
::
QueryRecorder
.
new
{
visit_milestone
}
control
=
ActiveRecord
::
QueryRecorder
.
new
{
visit_milestone
}
create
(
:labeled_issue
,
ISSUE_PARAMS
)
create
(
:labeled_issue
,
issue_params
)
expect
{
visit_milestone
}.
not_to
exceed_query_limit
(
control
)
expect
{
visit_milestone
}.
not_to
exceed_query_limit
(
control
)
end
end
...
...
spec/features/projects/branches/user_creates_branch_spec.rb
View file @
8fce7e48
...
@@ -16,18 +16,18 @@ describe "User creates branch", :js do
...
@@ -16,18 +16,18 @@ describe "User creates branch", :js do
end
end
it
"creates new branch"
do
it
"creates new branch"
do
BRANCH_NAME
=
"deploy_keys"
.
freeze
branch_name
=
"deploy_keys"
.
freeze
create_branch
(
BRANCH_NAME
)
create_branch
(
branch_name
)
expect
(
page
).
to
have_content
(
BRANCH_NAME
)
expect
(
page
).
to
have_content
(
branch_name
)
end
end
context
"when branch name is invalid"
do
context
"when branch name is invalid"
do
it
"does not create new branch"
do
it
"does not create new branch"
do
INVALID_BRANCH_NAME
=
"1.0 stable"
.
freeze
invalid_branch_name
=
"1.0 stable"
.
freeze
fill_in
(
"branch_name"
,
with:
INVALID_BRANCH_NAME
)
fill_in
(
"branch_name"
,
with:
invalid_branch_name
)
page
.
find
(
"body"
).
click
# defocus the branch_name input
page
.
find
(
"body"
).
click
# defocus the branch_name input
select_branch
(
"master"
)
select_branch
(
"master"
)
...
...
spec/features/projects/commit/comments/user_edits_comments_spec.rb
View file @
8fce7e48
...
@@ -19,7 +19,7 @@ describe "User edits a comment on a commit", :js do
...
@@ -19,7 +19,7 @@ describe "User edits a comment on a commit", :js do
end
end
it
"edits comment"
do
it
"edits comment"
do
NEW_COMMENT_TEXT
=
"+1 Awesome!"
.
freeze
new_comment_text
=
"+1 Awesome!"
.
freeze
page
.
within
(
".main-notes-list"
)
do
page
.
within
(
".main-notes-list"
)
do
note
=
find
(
".note"
)
note
=
find
(
".note"
)
...
@@ -31,14 +31,14 @@ describe "User edits a comment on a commit", :js do
...
@@ -31,14 +31,14 @@ describe "User edits a comment on a commit", :js do
page
.
find
(
".current-note-edit-form textarea"
)
page
.
find
(
".current-note-edit-form textarea"
)
page
.
within
(
".current-note-edit-form"
)
do
page
.
within
(
".current-note-edit-form"
)
do
fill_in
(
"note[note]"
,
with:
NEW_COMMENT_TEXT
)
fill_in
(
"note[note]"
,
with:
new_comment_text
)
click_button
(
"Save comment"
)
click_button
(
"Save comment"
)
end
end
wait_for_requests
wait_for_requests
page
.
within
(
".note"
)
do
page
.
within
(
".note"
)
do
expect
(
page
).
to
have_content
(
NEW_COMMENT_TEXT
)
expect
(
page
).
to
have_content
(
new_comment_text
)
end
end
end
end
end
end
spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
View file @
8fce7e48
...
@@ -88,18 +88,18 @@ describe "User interacts with deploy keys", :js do
...
@@ -88,18 +88,18 @@ describe "User interacts with deploy keys", :js do
end
end
it
"adds new key"
do
it
"adds new key"
do
DEPLOY_KEY_TITLE
=
attributes_for
(
:key
)[
:title
]
deploy_key_title
=
attributes_for
(
:key
)[
:title
]
DEPLOY_KEY_BODY
=
attributes_for
(
:key
)[
:key
]
deploy_key_body
=
attributes_for
(
:key
)[
:key
]
fill_in
(
"deploy_key_title"
,
with:
DEPLOY_KEY_TITLE
)
fill_in
(
"deploy_key_title"
,
with:
deploy_key_title
)
fill_in
(
"deploy_key_key"
,
with:
DEPLOY_KEY_BODY
)
fill_in
(
"deploy_key_key"
,
with:
deploy_key_body
)
click_button
(
"Add key"
)
click_button
(
"Add key"
)
expect
(
current_path
).
to
eq
(
project_settings_repository_path
(
project
))
expect
(
current_path
).
to
eq
(
project_settings_repository_path
(
project
))
page
.
within
(
".deploy-keys"
)
do
page
.
within
(
".deploy-keys"
)
do
expect
(
page
).
to
have_content
(
DEPLOY_KEY_TITLE
)
expect
(
page
).
to
have_content
(
deploy_key_title
)
end
end
end
end
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