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
be1647f5
Commit
be1647f5
authored
May 21, 2020
by
Rajendra Kadam
Committed by
Peter Leitzen
May 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix leaky constant in relation factory spec
parent
84c36a86
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
22 deletions
+31
-22
.rubocop.yml
.rubocop.yml
+0
-1
changelogs/unreleased/leaky-constant-fix-33.yml
changelogs/unreleased/leaky-constant-fix-33.yml
+5
-0
spec/lib/gitlab/import_export/project/relation_factory_spec.rb
...lib/gitlab/import_export/project/relation_factory_spec.rb
+26
-21
No files found.
.rubocop.yml
View file @
be1647f5
...
@@ -356,7 +356,6 @@ RSpec/LeakyConstantDeclaration:
...
@@ -356,7 +356,6 @@ RSpec/LeakyConstantDeclaration:
-
'
spec/lib/gitlab/database/with_lock_retries_spec.rb'
-
'
spec/lib/gitlab/database/with_lock_retries_spec.rb'
-
'
spec/lib/gitlab/git/diff_collection_spec.rb'
-
'
spec/lib/gitlab/git/diff_collection_spec.rb'
-
'
spec/lib/gitlab/import_export/import_test_coverage_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/quick_actions/dsl_spec.rb'
-
'
spec/lib/gitlab/quick_actions/dsl_spec.rb'
-
'
spec/lib/marginalia_spec.rb'
-
'
spec/lib/marginalia_spec.rb'
-
'
spec/mailers/notify_spec.rb'
-
'
spec/mailers/notify_spec.rb'
...
...
changelogs/unreleased/leaky-constant-fix-33.yml
0 → 100644
View file @
be1647f5
---
title
:
Fix leaky constant issue in relation factory spec
merge_request
:
32129
author
:
Rajendra Kadam
type
:
fixed
spec/lib/gitlab/import_export/project/relation_factory_spec.rb
View file @
be1647f5
...
@@ -18,6 +18,22 @@ describe Gitlab::ImportExport::Project::RelationFactory do
...
@@ -18,6 +18,22 @@ describe Gitlab::ImportExport::Project::RelationFactory do
excluded_keys:
excluded_keys
)
excluded_keys:
excluded_keys
)
end
end
before
do
# Mocks an ActiveRecordish object with the dodgy columns
stub_const
(
'FooModel'
,
Class
.
new
)
FooModel
.
class_eval
do
include
ActiveModel
::
Model
def
initialize
(
params
=
{})
params
.
each
{
|
key
,
value
|
send
(
"
#{
key
}
="
,
value
)
}
end
def
values
instance_variables
.
map
{
|
ivar
|
instance_variable_get
(
ivar
)
}
end
end
end
context
'hook object'
do
context
'hook object'
do
let
(
:relation_sym
)
{
:hooks
}
let
(
:relation_sym
)
{
:hooks
}
let
(
:id
)
{
999
}
let
(
:id
)
{
999
}
...
@@ -83,19 +99,6 @@ describe Gitlab::ImportExport::Project::RelationFactory do
...
@@ -83,19 +99,6 @@ describe Gitlab::ImportExport::Project::RelationFactory do
end
end
end
end
# Mocks an ActiveRecordish object with the dodgy columns
class
FooModel
include
ActiveModel
::
Model
def
initialize
(
params
=
{})
params
.
each
{
|
key
,
value
|
send
(
"
#{
key
}
="
,
value
)
}
end
def
values
instance_variables
.
map
{
|
ivar
|
instance_variable_get
(
ivar
)
}
end
end
context
'merge_request object'
do
context
'merge_request object'
do
let
(
:relation_sym
)
{
:merge_requests
}
let
(
:relation_sym
)
{
:merge_requests
}
...
@@ -208,11 +211,12 @@ describe Gitlab::ImportExport::Project::RelationFactory do
...
@@ -208,11 +211,12 @@ describe Gitlab::ImportExport::Project::RelationFactory do
}
}
end
end
class
HazardousFooModel
<
FooModel
before
do
stub_const
(
'HazardousFooModel'
,
Class
.
new
(
FooModel
))
HazardousFooModel
.
class_eval
do
attr_accessor
:service_id
,
:moved_to_id
,
:namespace_id
,
:ci_id
,
:random_project_id
,
:random_id
,
:milestone_id
,
:project_id
attr_accessor
:service_id
,
:moved_to_id
,
:namespace_id
,
:ci_id
,
:random_project_id
,
:random_id
,
:milestone_id
,
:project_id
end
end
before
do
allow
(
HazardousFooModel
).
to
receive
(
:reflect_on_association
).
and_return
(
nil
)
allow
(
HazardousFooModel
).
to
receive
(
:reflect_on_association
).
and_return
(
nil
)
end
end
...
@@ -246,11 +250,12 @@ describe Gitlab::ImportExport::Project::RelationFactory do
...
@@ -246,11 +250,12 @@ describe Gitlab::ImportExport::Project::RelationFactory do
Gitlab
::
ImportExport
::
Project
::
RelationFactory
::
PROJECT_REFERENCES
.
map
{
|
ref
|
{
ref
=>
99
}
}.
inject
(
:merge
)
Gitlab
::
ImportExport
::
Project
::
RelationFactory
::
PROJECT_REFERENCES
.
map
{
|
ref
|
{
ref
=>
99
}
}.
inject
(
:merge
)
end
end
class
ProjectFooModel
<
FooModel
before
do
stub_const
(
'ProjectFooModel'
,
Class
.
new
(
FooModel
))
ProjectFooModel
.
class_eval
do
attr_accessor
(
*
Gitlab
::
ImportExport
::
Project
::
RelationFactory
::
PROJECT_REFERENCES
)
attr_accessor
(
*
Gitlab
::
ImportExport
::
Project
::
RelationFactory
::
PROJECT_REFERENCES
)
end
end
before
do
allow
(
ProjectFooModel
).
to
receive
(
:reflect_on_association
).
and_return
(
nil
)
allow
(
ProjectFooModel
).
to
receive
(
:reflect_on_association
).
and_return
(
nil
)
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