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
Hide 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:
Exclude
:
-
'
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/serializers/vulnerable_project_entity_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 @@
require
'spec_helper'
describe
Gitlab
::
Geo
::
LogCursor
::
Logger
,
:geo
do
class
LoggerSpec
;
end
subject
(
:logger
)
{
described_class
.
new
(
LoggerSpec
)
}
let
(
:data
)
{
{
pid:
111
,
class:
'LoggerSpec'
,
host:
'localhost'
,
message:
'Test'
}
}
before
do
stub_const
(
'LoggerSpec'
,
Class
.
new
)
stub_const
(
"
#{
described_class
.
name
}
::PID"
,
111
)
end
...
...
ee/spec/lib/gitlab/geo/log_helpers_spec.rb
View file @
68c6fea8
...
...
@@ -3,11 +3,15 @@
require
'spec_helper'
describe
Gitlab
::
Geo
::
LogHelpers
do
class
FakeLogHelpersConsumer
include
Gitlab
::
Geo
::
LogHelpers
before
do
stub_const
(
'FakeLogHelpersConsumer'
,
Class
.
new
)
def
execute
log_error
(
'Test message'
)
FakeLogHelpersConsumer
.
class_eval
do
include
Gitlab
::
Geo
::
LogHelpers
def
execute
log_error
(
'Test message'
)
end
end
end
...
...
ee/spec/lib/gitlab/geo/replicator_spec.rb
View file @
68c6fea8
...
...
@@ -4,14 +4,18 @@ require 'spec_helper'
describe
Gitlab
::
Geo
::
Replicator
do
context
'with defined events'
do
class
DummyReplicator
<
Gitlab
::
Geo
::
Replicator
event
:test
event
:another_test
before
do
stub_const
(
'DummyReplicator'
,
Class
.
new
(
Gitlab
::
Geo
::
Replicator
))
protected
DummyReplicator
.
class_eval
do
event
:test
event
:another_test
def
publish_test
(
other
:)
true
protected
def
publish_test
(
other
:)
true
end
end
end
...
...
@@ -36,15 +40,19 @@ describe Gitlab::Geo::Replicator do
end
context
'model DSL'
do
class
DummyModel
include
ActiveModel
::
Model
before
do
stub_const
(
'DummyModel'
,
Class
.
new
)
def
self
.
after_create_commit
(
*
args
)
end
DummyModel
.
class_eval
do
include
ActiveModel
::
Model
include
Gitlab
::
Geo
::
ReplicableModel
def
self
.
after_create_commit
(
*
args
)
end
with_replicator
DummyReplicator
include
Gitlab
::
Geo
::
ReplicableModel
with_replicator
DummyReplicator
end
end
subject
{
DummyModel
.
new
}
...
...
ee/spec/mailers/emails/service_desk_spec.rb
View file @
68c6fea8
...
...
@@ -15,39 +15,43 @@ describe Emails::ServiceDesk do
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:template
)
{
double
(
content:
template_content
)
}
class
ServiceEmailClass
<
ApplicationMailer
include
GitlabRoutingHelper
include
EmailsHelper
include
Emails
::
ServiceDesk
before
do
stub_const
(
'ServiceEmailClass'
,
Class
.
new
(
ApplicationMailer
))
helper
GitlabRoutingHelper
helper
EmailsHelper
ServiceEmailClass
.
class_eval
do
include
GitlabRoutingHelper
include
EmailsHelper
include
Emails
::
ServiceDesk
append_view_path
Rails
.
root
.
join
(
'ee'
,
'app'
,
'views'
,
'notify'
)
helper
GitlabRoutingHelper
helper
EmailsHelper
# this method is implemented in Notify class, we don't need to test it
def
reply_key
'test-key'
end
append_view_path
Rails
.
root
.
join
(
'ee'
,
'app'
,
'views'
,
'notify'
)
# this method is implemented in Notify class, we don't need to test it
def
sender
(
author_id
,
params
=
{})
author_id
end
# this method is implemented in Notify class, we don't need to test it
def
reply_key
'test-key'
end
# this method is implemented in Notify class
#
# We do not need to test the Notify method, it is already tested in notify_spec
def
mail_new_thread
(
issue
,
options
)
# we need to rewrite this in order to look up templates in the correct directory
self
.
class
.
mailer_name
=
'notify'
# this method is implemented in Notify class, we don't need to test it
def
sender
(
author_id
,
params
=
{})
author_id
end
# this method is implemented in Notify class
#
# We do not need to test the Notify method, it is already tested in notify_spec
def
mail_new_thread
(
issue
,
options
)
# we need to rewrite this in order to look up templates in the correct directory
self
.
class
.
mailer_name
=
'notify'
# this is needed for default layout
@unsubscribe_url
=
'http://unsubscribe.example.com'
# this is needed for default layout
@unsubscribe_url
=
'http://unsubscribe.example.com'
mail
(
options
)
mail
(
options
)
end
alias_method
:mail_answer_thread
,
:mail_new_thread
end
alias_method
:mail_answer_thread
,
:mail_new_thread
end
shared_examples
'handle template content'
do
|
template_key
|
...
...
ee/spec/migrations/remove_creations_in_gitlab_subscription_histories_spec.rb
View file @
68c6fea8
...
...
@@ -4,9 +4,11 @@ require 'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20200113151354_remove_creations_in_gitlab_subscription_histories.rb'
)
describe
RemoveCreationsInGitlabSubscriptionHistories
do
GITLAB_SUBSCRIPTION_CREATED
=
0
GITLAB_SUBSCRIPTION_UPDATED
=
1
GITLAB_SUBSCRIPTION_DESTROYED
=
2
before
do
stub_const
(
'GITLAB_SUBSCRIPTION_CREATED'
,
0
)
stub_const
(
'GITLAB_SUBSCRIPTION_UPDATED'
,
1
)
stub_const
(
'GITLAB_SUBSCRIPTION_DESTROYED'
,
2
)
end
let
(
:gitlab_subscriptions
)
{
table
(
:gitlab_subscriptions
)
}
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'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20191114173624_set_resolved_state_on_vulnerabilities.rb'
)
describe
SetResolvedStateOnVulnerabilities
do
PACK_FORMAT
=
'H*'
let
(
:confidence_levels
)
do
{
undefined:
0
,
ignore:
1
,
unknown:
2
,
experimental:
3
,
low:
4
,
medium:
5
,
high:
6
,
confirmed:
7
}
end
...
...
@@ -47,6 +45,8 @@ describe SetResolvedStateOnVulnerabilities do
end
before
do
stub_const
(
'PACK_FORMAT'
,
'H*'
)
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
)
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
include
::
EE
::
GeoHelpers
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
(
: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