Skip to content
代码片段 群组 项目
未验证 提交 469e3df0 编辑于 作者: Ethan Urie's avatar Ethan Urie 提交者: GitLab
浏览文件

Merge branch 'fix/500-on-viewing-group-analytics' into 'master'

Fix broken schema path on group analytics dashboard

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157228



Merged-by: default avatarEthan Urie <eurie@gitlab.com>
Approved-by: default avatarSam Figueroa <sfigueroa@gitlab.com>
Approved-by: default avatarEthan Urie <eurie@gitlab.com>
Reviewed-by: default avatarEthan Urie <eurie@gitlab.com>
Co-authored-by: default avatarAnton Smith <asmith@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -3,7 +3,7 @@
module ProductAnalytics
module SchemaValidator
def schema_errors_for(yaml)
validator = JSONSchemer.schema(Pathname.new(self.class::SCHEMA_PATH))
validator = JSONSchemer.schema(Pathname.new(Rails.root.join(self.class::SCHEMA_PATH)))
validator_errors = validator.validate(yaml)
validator_errors.map { |e| JSONSchemer::Errors.pretty(e) } if validator_errors.any?
end
......
......@@ -47,6 +47,17 @@
end
end
describe '#schema_errors_for' do
let(:dashboard) { dashboards.find { |d| d.title == 'Audience' } }
it 'fetches correct schema path' do
allow(JSONSchemer).to receive(:schema).and_call_original
expect(JSONSchemer).to receive(:schema).with(Rails.root.join(described_class::SCHEMA_PATH))
dashboard.panels.first.visualization
end
end
describe '.for' do
context 'when resource_parent is a Project' do
subject { described_class.for(container: project, user: user) }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册