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
61fffbe0
Commit
61fffbe0
authored
May 14, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dont use class_eval
parent
b521c390
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
spec/graphql/gitlab_schema_spec.rb
spec/graphql/gitlab_schema_spec.rb
+3
-3
spec/helpers/visibility_level_helper_spec.rb
spec/helpers/visibility_level_helper_spec.rb
+8
-8
spec/lib/gitlab/background_migration/migrate_issue_trackers_sensitive_data_spec.rb
...d_migration/migrate_issue_trackers_sensitive_data_spec.rb
+5
-5
No files found.
spec/graphql/gitlab_schema_spec.rb
View file @
61fffbe0
...
...
@@ -192,9 +192,7 @@ describe GitlabSchema do
# We cannot use an anonymous class here as `GlobalID` expects `.name` not
# to return `nil`
before
do
stub_const
(
'TestGlobalId'
,
Class
.
new
)
TestGlobalId
.
class_eval
do
test_global_id
=
Class
.
new
do
include
GlobalID
::
Identification
attr_accessor
:id
...
...
@@ -202,6 +200,8 @@ describe GitlabSchema do
@id
=
id
end
end
stub_const
(
'TestGlobalId'
,
test_global_id
)
end
it
'falls back to a regular find'
do
...
...
spec/helpers/visibility_level_helper_spec.rb
View file @
61fffbe0
...
...
@@ -149,19 +149,19 @@ describe VisibilityLevelHelper do
# This is a subset of all the permutations
where
(
:requested_level
,
:max_allowed
,
:global_default_level
,
:restricted_levels
,
:expected
)
do
public_vis
=
Gitlab
::
VisibilityLevel
::
PUBLIC
internal
=
Gitlab
::
VisibilityLevel
::
INTERNAL
internal
_vis
=
Gitlab
::
VisibilityLevel
::
INTERNAL
private_vis
=
Gitlab
::
VisibilityLevel
::
PRIVATE
public_vis
|
public_vis
|
public_vis
|
[]
|
public_vis
public_vis
|
public_vis
|
public_vis
|
[
public_vis
]
|
internal
internal
|
public_vis
|
public_vis
|
[]
|
internal
internal
|
private_vis
|
private_vis
|
[]
|
private_vis
public_vis
|
public_vis
|
public_vis
|
[
public_vis
]
|
internal
_vis
internal
_vis
|
public_vis
|
public_vis
|
[]
|
internal_vis
internal
_vis
|
private_vis
|
private_vis
|
[]
|
private_vis
private_vis
|
public_vis
|
public_vis
|
[]
|
private_vis
public_vis
|
private_vis
|
internal
|
[]
|
private_vis
public_vis
|
internal
|
public_vis
|
[]
|
internal
public_vis
|
private_vis
|
internal
_vis
|
[]
|
private_vis
public_vis
|
internal
_vis
|
public_vis
|
[]
|
internal_vis
public_vis
|
private_vis
|
public_vis
|
[]
|
private_vis
public_vis
|
internal
|
internal
|
[]
|
internal
public_vis
|
public_vis
|
internal
|
[]
|
public_vis
public_vis
|
internal
_vis
|
internal_vis
|
[]
|
internal_vis
public_vis
|
public_vis
|
internal
_vis
|
[]
|
public_vis
end
before
do
...
...
spec/lib/gitlab/background_migration/migrate_issue_trackers_sensitive_data_spec.rb
View file @
61fffbe0
...
...
@@ -6,10 +6,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
before
do
# we need to define the classes due to encryption
stub_const
(
'IssueTrackerData'
,
Class
.
new
(
ApplicationRecord
))
stub_const
(
'JiraTrackerData'
,
Class
.
new
(
ApplicationRecord
))
IssueTrackerData
.
class_eval
do
issue_tracker_data
=
Class
.
new
(
ApplicationRecord
)
do
self
.
table_name
=
'issue_tracker_data'
def
self
.
encryption_options
...
...
@@ -26,7 +23,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
attr_encrypted
:new_issue_url
,
encryption_options
end
JiraTrackerData
.
class_eval
do
jira_tracker_data
=
Class
.
new
(
ApplicationRecord
)
do
self
.
table_name
=
'jira_tracker_data'
def
self
.
encryption_options
...
...
@@ -43,6 +40,9 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
attr_encrypted
:username
,
encryption_options
attr_encrypted
:password
,
encryption_options
end
stub_const
(
'IssueTrackerData'
,
issue_tracker_data
)
stub_const
(
'JiraTrackerData'
,
jira_tracker_data
)
end
let
(
:url
)
{
'http://base-url.tracker.com'
}
...
...
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