Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
nexedi
gitlab-ce
Commits
f19e84ee
Commit
f19e84ee
authored
3 years ago
by
Grzegorz Bizon
Committed by
Kamil Trzciński
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix query analyzers base context / suppress keys
parent
b087a567
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
lib/gitlab/database/query_analyzers/base.rb
lib/gitlab/database/query_analyzers/base.rb
+6
-2
spec/lib/gitlab/database/query_analyzers/prevent_cross_database_modification_spec.rb
...ery_analyzers/prevent_cross_database_modification_spec.rb
+16
-0
No files found.
lib/gitlab/database/query_analyzers/base.rb
View file @
f19e84ee
...
...
@@ -48,11 +48,15 @@ module Gitlab
end
def
self
.
context_key
"
#{
self
.
class
.
name
}
_context"
@context_key
||=
"analyzer_
#{
self
.
analyzer_key
}
_context"
.
to_sym
end
def
self
.
suppress_key
"
#{
self
.
class
.
name
}
_suppressed"
@suppress_key
||=
"analyzer_
#{
self
.
analyzer_key
}
_suppressed"
.
to_sym
end
def
self
.
analyzer_key
@analyzer_key
||=
self
.
name
.
demodulize
.
underscore
.
to_sym
end
end
end
...
...
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/database/query_analyzers/prevent_cross_database_modification_spec.rb
View file @
f19e84ee
...
...
@@ -14,6 +14,22 @@ RSpec.describe Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModificatio
Gitlab
::
Database
::
QueryAnalyzer
.
instance
.
within
{
example
.
run
}
end
describe
'context and suppress key names'
do
describe
'.context_key'
do
it
'contains class name'
do
expect
(
described_class
.
context_key
)
.
to
eq
'analyzer_prevent_cross_database_modification_context'
.
to_sym
end
end
describe
'.suppress_key'
do
it
'contains class name'
do
expect
(
described_class
.
suppress_key
)
.
to
eq
'analyzer_prevent_cross_database_modification_suppressed'
.
to_sym
end
end
end
shared_examples
'successful examples'
do
|
model
:|
let
(
:model
)
{
model
}
...
...
This diff is collapsed.
Click to expand it.
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