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
4bf5ff00
Commit
4bf5ff00
authored
Apr 28, 2021
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add snowplow helper for schema match
Add matcher for snowplow context schema assertion
parent
d91fc31a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
spec/support/helpers/snowplow_helpers.rb
spec/support/helpers/snowplow_helpers.rb
+4
-0
spec/support/matchers/schema_matcher.rb
spec/support/matchers/schema_matcher.rb
+11
-0
No files found.
spec/support/helpers/snowplow_helpers.rb
View file @
4bf5ff00
...
...
@@ -60,6 +60,10 @@ module SnowplowHelpers
.
with
(
category
,
action
,
**
kwargs
).
at_least
(
:once
)
end
def
match_snowplow_context_schema
(
schema_path
:,
context
:)
expect
(
context
).
to
match_snowplow_schema
(
schema_path
)
end
# Asserts that no call to `Gitlab::Tracking#event` was made.
#
# Example:
...
...
spec/support/matchers/schema_matcher.rb
View file @
4bf5ff00
...
...
@@ -45,6 +45,17 @@ RSpec::Matchers.define :match_response_schema do |schema, dir: nil, **options|
end
end
RSpec
::
Matchers
.
define
:match_snowplow_schema
do
|
schema
,
dir:
nil
,
**
options
|
match
do
|
response
|
schema_path
=
Pathname
.
new
(
SchemaPath
.
expand
(
schema
,
dir
))
validator
=
SchemaPath
.
validator
(
schema_path
)
data
=
Gitlab
::
Json
.
parse
(
response
.
body
)
validator
.
valid?
(
data
)
end
end
RSpec
::
Matchers
.
define
:match_schema
do
|
schema
,
dir:
nil
,
**
options
|
match
do
|
data
|
schema
=
SchemaPath
.
expand
(
schema
,
dir
)
...
...
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