Commit 5a715664 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ali/add-source-to-gitlab-standard-context' into 'master'

Add `source` to Snowplow StandardContext

See merge request gitlab-org/gitlab!52737
parents 5fd14297 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, user: nil, **data)
@data = data
......@@ -21,6 +22,10 @@ module Gitlab
'development'
end
def source
GITLAB_RAILS_SOURCE
end
private
def to_h
......
......@@ -9,7 +9,7 @@ RSpec.describe Gitlab::Tracking::StandardContext do
let(:snowplow_context) { subject.to_context }
describe '#to_context' do
context 'with no arguments' do
context 'default fields' 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment