diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-12 03:10:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-12 03:10:27 +0300 |
commit | a160c4b1a72105a751cdc2f9f973dbe39a1c0dfd (patch) | |
tree | 8383dcf5249407b3301289415ed9c3daccd43057 /spec/support/matchers | |
parent | 0ae8428c8e77d5d7e098827be688b1f146321af1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/matchers')
-rw-r--r-- | spec/support/matchers/schema_matcher.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/support/matchers/schema_matcher.rb b/spec/support/matchers/schema_matcher.rb index e8a7964b820..94e4359b1dd 100644 --- a/spec/support/matchers/schema_matcher.rb +++ b/spec/support/matchers/schema_matcher.rb @@ -45,6 +45,15 @@ 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 |data| + schema_path = Pathname.new(Rails.root.join(dir.to_s, 'spec', "fixtures/product_intelligence/#{schema}.json").to_s) + validator = SchemaPath.validator(schema_path) + + validator.valid?(data.stringify_keys) + end +end + RSpec::Matchers.define :match_schema do |schema, dir: nil, **options| match do |data| schema = SchemaPath.expand(schema, dir) |