Commit 7dcb21ee authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Bob Van Landuyt

Fixes No such file or directory for pager_duty/validator

https://gitlab.com/gitlab-org/gitlab/-/issues/322901

Fixes:
No such file or directory lib/pager_duty/validator/schemas/message.json
parent 4a783817
---
title: 'Fixes: No such file or directory lib/pager_duty/validator/schemas/message.json'
merge_request: 55725
author:
type: fixed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module PagerDuty module PagerDuty
class WebhookPayloadParser class WebhookPayloadParser
SCHEMA_PATH = File.join('lib', 'pager_duty', 'validator', 'schemas', 'message.json') SCHEMA_PATH = Rails.root.join('lib', 'pager_duty', 'validator', 'schemas', 'message.json')
def initialize(payload) def initialize(payload)
@payload = payload @payload = payload
...@@ -66,7 +66,7 @@ module PagerDuty ...@@ -66,7 +66,7 @@ module PagerDuty
end end
def valid_message?(message) def valid_message?(message)
::JSONSchemer.schema(Pathname.new(SCHEMA_PATH)).valid?(message) ::JSONSchemer.schema(SCHEMA_PATH).valid?(message)
end end
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
require 'fast_spec_helper' require 'spec_helper'
require 'json_schemer'
RSpec.describe PagerDuty::WebhookPayloadParser do RSpec.describe PagerDuty::WebhookPayloadParser do
describe '.call' do describe '.call' 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