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
3fc1d220
Commit
3fc1d220
authored
Apr 06, 2022
by
Axel García
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix EE override of Tracking.definition
parent
ac138099
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
6 deletions
+25
-6
ee/lib/ee/gitlab/tracking.rb
ee/lib/ee/gitlab/tracking.rb
+1
-1
ee/spec/lib/ee/gitlab/tracking_spec.rb
ee/spec/lib/ee/gitlab/tracking_spec.rb
+15
-2
lib/gitlab/tracking.rb
lib/gitlab/tracking.rb
+2
-0
spec/lib/gitlab/tracking_spec.rb
spec/lib/gitlab/tracking_spec.rb
+7
-3
No files found.
ee/lib/ee/gitlab/tracking.rb
View file @
3fc1d220
...
...
@@ -20,7 +20,7 @@ module EE
definition
=
YAML
.
load_file
(
Rails
.
root
.
join
(
*
events_path
,
"
#{
basename
}
.yml"
))
s
uper
.
dispatch_from_definition
(
definition
,
label:
label
,
property:
property
,
value:
value
,
context:
context
,
s
elf
.
dispatch_from_definition
(
definition
,
label:
label
,
property:
property
,
value:
value
,
context:
context
,
project:
project
,
user:
user
,
namespace:
namespace
,
**
extra
)
end
end
...
...
ee/spec/lib/ee/gitlab/tracking_spec.rb
View file @
3fc1d220
...
...
@@ -2,10 +2,23 @@
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Tracking
do
RSpec
.
describe
::
Gitlab
::
Tracking
do
describe
'.definition'
do
let_it_be
(
:test_definition
)
{{
'category'
:
'category'
,
'action'
:
'action'
}}
let_it_be
(
:filepath
)
{
Rails
.
root
.
join
(
'ee/config/events/filename.yml'
)
}
before
do
allow_next_instance_of
(
described_class
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:event
)
end
allow_next_instance_of
(
Gitlab
::
Tracking
::
Destinations
::
Snowplow
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:event
)
end
allow
(
YAML
).
to
receive
(
:load_file
).
with
(
filepath
).
and_return
(
test_definition
)
end
it
'fetch EE definitions when prefixed with ee_'
do
expect
(
YAML
).
to
receive
(
:load_file
).
with
(
Rails
.
root
.
join
(
'ee/config/events/filename.yml'
)
)
expect
(
YAML
).
to
receive
(
:load_file
).
with
(
filepath
)
described_class
.
definition
(
+
'ee_filename'
)
end
...
...
lib/gitlab/tracking.rb
View file @
3fc1d220
...
...
@@ -22,6 +22,8 @@ module Gitlab
end
def
dispatch_from_definition
(
definition
,
**
event_data
)
definition
=
definition
.
with_indifferent_access
category
||=
definition
[
:category
]
action
||=
definition
[
:action
]
...
...
spec/lib/gitlab/tracking_spec.rb
View file @
3fc1d220
...
...
@@ -156,11 +156,15 @@ RSpec.describe Gitlab::Tracking do
let_it_be
(
:definition_action
)
{
'definition_action'
}
let_it_be
(
:definition_category
)
{
'definition_category'
}
let_it_be
(
:label_description
)
{
'definition label description'
}
let_it_be
(
:test_definition
)
{{
description:
'Test definition'
,
category:
definition_category
,
action
:
definition_action
}}
let_it_be
(
:test_definition
)
{{
'category'
:
definition_category
,
'action'
:
definition_action
}}
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:event
)
allow_any_instance_of
(
Gitlab
::
Tracking
::
Destinations
::
Snowplow
).
to
receive
(
:event
)
allow_next_instance_of
(
described_class
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:event
)
end
allow_next_instance_of
(
Gitlab
::
Tracking
::
Destinations
::
Snowplow
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:event
)
end
allow
(
YAML
).
to
receive
(
:load_file
).
with
(
Rails
.
root
.
join
(
'config/events/filename.yml'
)).
and_return
(
test_definition
)
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