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
68c6fea8
Commit
68c6fea8
authored
Mar 24, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for RSpec/LeakyConstantDeclaration
Additional fixes for RSpec/LeakyConstantDeclaration cop.
parent
c4c22b06
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
56 deletions
+68
-56
.rubocop.yml
.rubocop.yml
+0
-7
ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb
ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb
+1
-2
ee/spec/lib/gitlab/geo/log_helpers_spec.rb
ee/spec/lib/gitlab/geo/log_helpers_spec.rb
+8
-4
ee/spec/lib/gitlab/geo/replicator_spec.rb
ee/spec/lib/gitlab/geo/replicator_spec.rb
+20
-12
ee/spec/mailers/emails/service_desk_spec.rb
ee/spec/mailers/emails/service_desk_spec.rb
+29
-25
ee/spec/migrations/remove_creations_in_gitlab_subscription_histories_spec.rb
...remove_creations_in_gitlab_subscription_histories_spec.rb
+5
-3
ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb
.../migrations/set_resolved_state_on_vulnerabilities_spec.rb
+2
-2
ee/spec/models/repository_spec.rb
ee/spec/models/repository_spec.rb
+3
-1
No files found.
.rubocop.yml
View file @
68c6fea8
...
@@ -330,13 +330,6 @@ RSpec/LeakyConstantDeclaration:
...
@@ -330,13 +330,6 @@ RSpec/LeakyConstantDeclaration:
Exclude
:
Exclude
:
-
'
spec/**/*.rb'
-
'
spec/**/*.rb'
-
'
qa/spec/**/*.rb'
-
'
qa/spec/**/*.rb'
-
'
ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb'
-
'
ee/spec/lib/gitlab/geo/log_helpers_spec.rb'
-
'
ee/spec/lib/gitlab/geo/replicator_spec.rb'
-
'
ee/spec/mailers/emails/service_desk_spec.rb'
-
'
ee/spec/migrations/remove_creations_in_gitlab_subscription_histories_spec.rb'
-
'
ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb'
-
'
ee/spec/models/repository_spec.rb'
-
'
ee/spec/presenters/security/vulnerable_project_presenter_spec.rb'
-
'
ee/spec/presenters/security/vulnerable_project_presenter_spec.rb'
-
'
ee/spec/serializers/vulnerable_project_entity_spec.rb'
-
'
ee/spec/serializers/vulnerable_project_entity_spec.rb'
-
'
ee/spec/services/clusters/applications/check_upgrade_progress_service_spec.rb'
-
'
ee/spec/services/clusters/applications/check_upgrade_progress_service_spec.rb'
...
...
ee/spec/lib/gitlab/geo/log_cursor/logger_spec.rb
View file @
68c6fea8
...
@@ -3,13 +3,12 @@
...
@@ -3,13 +3,12 @@
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Geo
::
LogCursor
::
Logger
,
:geo
do
describe
Gitlab
::
Geo
::
LogCursor
::
Logger
,
:geo
do
class
LoggerSpec
;
end
subject
(
:logger
)
{
described_class
.
new
(
LoggerSpec
)
}
subject
(
:logger
)
{
described_class
.
new
(
LoggerSpec
)
}
let
(
:data
)
{
{
pid:
111
,
class:
'LoggerSpec'
,
host:
'localhost'
,
message:
'Test'
}
}
let
(
:data
)
{
{
pid:
111
,
class:
'LoggerSpec'
,
host:
'localhost'
,
message:
'Test'
}
}
before
do
before
do
stub_const
(
'LoggerSpec'
,
Class
.
new
)
stub_const
(
"
#{
described_class
.
name
}
::PID"
,
111
)
stub_const
(
"
#{
described_class
.
name
}
::PID"
,
111
)
end
end
...
...
ee/spec/lib/gitlab/geo/log_helpers_spec.rb
View file @
68c6fea8
...
@@ -3,13 +3,17 @@
...
@@ -3,13 +3,17 @@
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Geo
::
LogHelpers
do
describe
Gitlab
::
Geo
::
LogHelpers
do
class
FakeLogHelpersConsumer
before
do
stub_const
(
'FakeLogHelpersConsumer'
,
Class
.
new
)
FakeLogHelpersConsumer
.
class_eval
do
include
Gitlab
::
Geo
::
LogHelpers
include
Gitlab
::
Geo
::
LogHelpers
def
execute
def
execute
log_error
(
'Test message'
)
log_error
(
'Test message'
)
end
end
end
end
end
def
stub_sidekiq_job_context
(
context
)
def
stub_sidekiq_job_context
(
context
)
original_value
=
Thread
.
current
[
:sidekiq_context
]
original_value
=
Thread
.
current
[
:sidekiq_context
]
...
...
ee/spec/lib/gitlab/geo/replicator_spec.rb
View file @
68c6fea8
...
@@ -4,7 +4,10 @@ require 'spec_helper'
...
@@ -4,7 +4,10 @@ require 'spec_helper'
describe
Gitlab
::
Geo
::
Replicator
do
describe
Gitlab
::
Geo
::
Replicator
do
context
'with defined events'
do
context
'with defined events'
do
class
DummyReplicator
<
Gitlab
::
Geo
::
Replicator
before
do
stub_const
(
'DummyReplicator'
,
Class
.
new
(
Gitlab
::
Geo
::
Replicator
))
DummyReplicator
.
class_eval
do
event
:test
event
:test
event
:another_test
event
:another_test
...
@@ -14,6 +17,7 @@ describe Gitlab::Geo::Replicator do
...
@@ -14,6 +17,7 @@ describe Gitlab::Geo::Replicator do
true
true
end
end
end
end
end
context
'event DSL'
do
context
'event DSL'
do
subject
{
DummyReplicator
}
subject
{
DummyReplicator
}
...
@@ -36,7 +40,10 @@ describe Gitlab::Geo::Replicator do
...
@@ -36,7 +40,10 @@ describe Gitlab::Geo::Replicator do
end
end
context
'model DSL'
do
context
'model DSL'
do
class
DummyModel
before
do
stub_const
(
'DummyModel'
,
Class
.
new
)
DummyModel
.
class_eval
do
include
ActiveModel
::
Model
include
ActiveModel
::
Model
def
self
.
after_create_commit
(
*
args
)
def
self
.
after_create_commit
(
*
args
)
...
@@ -46,6 +53,7 @@ describe Gitlab::Geo::Replicator do
...
@@ -46,6 +53,7 @@ describe Gitlab::Geo::Replicator do
with_replicator
DummyReplicator
with_replicator
DummyReplicator
end
end
end
subject
{
DummyModel
.
new
}
subject
{
DummyModel
.
new
}
...
...
ee/spec/mailers/emails/service_desk_spec.rb
View file @
68c6fea8
...
@@ -15,7 +15,10 @@ describe Emails::ServiceDesk do
...
@@ -15,7 +15,10 @@ describe Emails::ServiceDesk do
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:template
)
{
double
(
content:
template_content
)
}
let
(
:template
)
{
double
(
content:
template_content
)
}
class
ServiceEmailClass
<
ApplicationMailer
before
do
stub_const
(
'ServiceEmailClass'
,
Class
.
new
(
ApplicationMailer
))
ServiceEmailClass
.
class_eval
do
include
GitlabRoutingHelper
include
GitlabRoutingHelper
include
EmailsHelper
include
EmailsHelper
include
Emails
::
ServiceDesk
include
Emails
::
ServiceDesk
...
@@ -49,6 +52,7 @@ describe Emails::ServiceDesk do
...
@@ -49,6 +52,7 @@ describe Emails::ServiceDesk do
end
end
alias_method
:mail_answer_thread
,
:mail_new_thread
alias_method
:mail_answer_thread
,
:mail_new_thread
end
end
end
shared_examples
'handle template content'
do
|
template_key
|
shared_examples
'handle template content'
do
|
template_key
|
before
do
before
do
...
...
ee/spec/migrations/remove_creations_in_gitlab_subscription_histories_spec.rb
View file @
68c6fea8
...
@@ -4,9 +4,11 @@ require 'spec_helper'
...
@@ -4,9 +4,11 @@ require 'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20200113151354_remove_creations_in_gitlab_subscription_histories.rb'
)
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20200113151354_remove_creations_in_gitlab_subscription_histories.rb'
)
describe
RemoveCreationsInGitlabSubscriptionHistories
do
describe
RemoveCreationsInGitlabSubscriptionHistories
do
GITLAB_SUBSCRIPTION_CREATED
=
0
before
do
GITLAB_SUBSCRIPTION_UPDATED
=
1
stub_const
(
'GITLAB_SUBSCRIPTION_CREATED'
,
0
)
GITLAB_SUBSCRIPTION_DESTROYED
=
2
stub_const
(
'GITLAB_SUBSCRIPTION_UPDATED'
,
1
)
stub_const
(
'GITLAB_SUBSCRIPTION_DESTROYED'
,
2
)
end
let
(
:gitlab_subscriptions
)
{
table
(
:gitlab_subscriptions
)
}
let
(
:gitlab_subscriptions
)
{
table
(
:gitlab_subscriptions
)
}
let
(
:gitlab_subscription_histories
)
{
table
(
:gitlab_subscription_histories
)
}
let
(
:gitlab_subscription_histories
)
{
table
(
:gitlab_subscription_histories
)
}
...
...
ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb
View file @
68c6fea8
...
@@ -4,8 +4,6 @@ require 'spec_helper'
...
@@ -4,8 +4,6 @@ require 'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20191114173624_set_resolved_state_on_vulnerabilities.rb'
)
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20191114173624_set_resolved_state_on_vulnerabilities.rb'
)
describe
SetResolvedStateOnVulnerabilities
do
describe
SetResolvedStateOnVulnerabilities
do
PACK_FORMAT
=
'H*'
let
(
:confidence_levels
)
do
let
(
:confidence_levels
)
do
{
undefined:
0
,
ignore:
1
,
unknown:
2
,
experimental:
3
,
low:
4
,
medium:
5
,
high:
6
,
confirmed:
7
}
{
undefined:
0
,
ignore:
1
,
unknown:
2
,
experimental:
3
,
low:
4
,
medium:
5
,
high:
6
,
confirmed:
7
}
end
end
...
@@ -47,6 +45,8 @@ describe SetResolvedStateOnVulnerabilities do
...
@@ -47,6 +45,8 @@ describe SetResolvedStateOnVulnerabilities do
end
end
before
do
before
do
stub_const
(
'PACK_FORMAT'
,
'H*'
)
author
=
users
.
create!
(
id:
1
,
email:
'author@example.com'
,
projects_limit:
10
)
author
=
users
.
create!
(
id:
1
,
email:
'author@example.com'
,
projects_limit:
10
)
closer
=
users
.
create!
(
id:
closer_id
,
email:
'closer@example.com'
,
projects_limit:
10
)
closer
=
users
.
create!
(
id:
closer_id
,
email:
'closer@example.com'
,
projects_limit:
10
)
namespace
=
namespaces
.
create!
(
id:
1
,
name:
'namespace_1'
,
path:
'namespace_1'
,
owner_id:
author
.
id
)
namespace
=
namespaces
.
create!
(
id:
1
,
name:
'namespace_1'
,
path:
'namespace_1'
,
owner_id:
author
.
id
)
...
...
ee/spec/models/repository_spec.rb
View file @
68c6fea8
...
@@ -7,7 +7,9 @@ describe Repository do
...
@@ -7,7 +7,9 @@ describe Repository do
include
::
EE
::
GeoHelpers
include
::
EE
::
GeoHelpers
include
GitHelpers
include
GitHelpers
TestBlob
=
Struct
.
new
(
:path
)
before
do
stub_const
(
'TestBlob'
,
Struct
.
new
(
:path
))
end
let_it_be
(
:primary_node
)
{
create
(
:geo_node
,
:primary
)
}
let_it_be
(
:primary_node
)
{
create
(
:geo_node
,
:primary
)
}
let_it_be
(
:secondary_node
)
{
create
(
:geo_node
)
}
let_it_be
(
:secondary_node
)
{
create
(
:geo_node
)
}
...
...
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