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
8820b856
Commit
8820b856
authored
Jan 27, 2021
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `source` to Snowplow StandardContext
parent
bfce8bed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
lib/gitlab/tracking/standard_context.rb
lib/gitlab/tracking/standard_context.rb
+5
-0
spec/lib/gitlab/tracking/standard_context_spec.rb
spec/lib/gitlab/tracking/standard_context_spec.rb
+5
-1
No files found.
lib/gitlab/tracking/standard_context.rb
View file @
8820b856
...
...
@@ -4,6 +4,7 @@ module Gitlab
module
Tracking
class
StandardContext
GITLAB_STANDARD_SCHEMA_URL
=
'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-2'
.
freeze
GITLAB_RAILS_SOURCE
=
'gitlab-rails'
.
freeze
def
initialize
(
namespace:
nil
,
project:
nil
,
**
data
)
@namespace
=
namespace
...
...
@@ -23,6 +24,10 @@ module Gitlab
'development'
end
def
source
GITLAB_RAILS_SOURCE
end
private
def
to_h
...
...
spec/lib/gitlab/tracking/standard_context_spec.rb
View file @
8820b856
...
...
@@ -9,7 +9,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do
let
(
:snowplow_context
)
{
subject
.
to_context
}
describe
'#to_context'
do
context
'
with no argument
s'
do
context
'
default field
s'
do
context
'environment'
do
shared_examples
'contains environment'
do
|
expected_environment
|
it
'contains environment'
do
...
...
@@ -37,6 +37,10 @@ RSpec.describe Gitlab::Tracking::StandardContext do
include_examples
'contains environment'
,
'production'
end
end
it
'contains source'
do
expect
(
snowplow_context
.
to_json
.
dig
(
:data
,
:source
)).
to
eq
(
described_class
::
GITLAB_RAILS_SOURCE
)
end
end
context
'with extra data'
do
...
...
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