Commit 7f818790 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix tests after merge request widget changes

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 9b9b6b4d
......@@ -4,11 +4,11 @@ module EE
prepended do
expose :blob_path do
expose :head, if: -> (mr, _) { mr.head_pipeline_sha } do |merge_request|
expose :head_path, if: -> (mr, _) { mr.head_pipeline_sha } do |merge_request|
project_blob_path(merge_request.project, merge_request.head_pipeline_sha)
end
expose :base, if: -> (mr, _) { mr.base_pipeline_sha } do |merge_request|
expose :base_path, if: -> (mr, _) { mr.base_pipeline_sha } do |merge_request|
project_blob_path(merge_request.project, merge_request.base_pipeline_sha)
end
end
......
......@@ -174,23 +174,33 @@ describe MergeRequest do
end
describe '#head_sast_artifact' do
it { is_expected.to delegate_method(:head_sast_artifact).to(:head_pipeline) }
it { is_expected.to delegate_method(:sast_artifact).to(:head_pipeline).with_prefix(:head) }
end
describe '#base_sast_artifact' do
it { is_expected.to delegate_method(:base_sast_artifact).to(:base_pipeline) }
it { is_expected.to delegate_method(:sast_artifact).to(:base_pipeline).with_prefix(:base) }
end
describe '#has_sast_data?' do
let(:artifact) { double(success?: true) }
before do
allow(merge_request).to receive(:sast_artifact).and_return(artifact)
allow(merge_request).to receive(:head_sast_artifact).and_return(artifact)
end
it { expect(merge_request.has_sast_data?).to be_truthy }
end
describe '#has_base_sast_data?' do
let(:artifact) { double(success?: true) }
before do
allow(merge_request).to receive(:base_sast_artifact).and_return(artifact)
end
it { expect(merge_request.has_base_sast_data?).to be_truthy }
end
describe '#sast_container_artifact' do
it { is_expected.to delegate_method(:sast_container_artifact).to(:head_pipeline) }
end
......
......@@ -16,8 +16,8 @@ describe MergeRequestWidgetEntity do
allow(merge_request).to receive(:head_pipeline).and_return(pipeline)
expect(subject.as_json).to include(:blob_path)
expect(subject.as_json[:blob_path]).to include(:base)
expect(subject.as_json[:blob_path]).to include(:head)
expect(subject.as_json[:blob_path]).to include(:base_path)
expect(subject.as_json[:blob_path]).to include(:head_path)
end
it 'has performance data' do
......
......@@ -116,9 +116,11 @@
"approvals_path": { "type": ["string", "null"] },
"codeclimate": {
"head_path": { "type": "string" },
"head_blob_path": { "type": "string" },
"base_path": { "type": "string" },
"base_blob_path": { "type": "string" }
"base_path": { "type": "string" }
},
"blob_path": {
"head_path": { "type": "string" },
"base_path": { "type": "string" }
}
},
"additionalProperties": false
......
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