Fix GeoNode#job_artifacts guard clause

parent 2ecaf4a2
...@@ -219,7 +219,7 @@ class GeoNode < ApplicationRecord ...@@ -219,7 +219,7 @@ class GeoNode < ApplicationRecord
end end
def job_artifacts def job_artifacts
Ci::JobArtifact.all unless selective_sync? return Ci::JobArtifact.all unless selective_sync?
Ci::JobArtifact.project_id_in(projects) Ci::JobArtifact.project_id_in(projects)
end end
......
...@@ -744,4 +744,26 @@ describe GeoNode, :request_store, :geo, type: :model do ...@@ -744,4 +744,26 @@ describe GeoNode, :request_store, :geo, type: :model do
end end
end end
end end
describe '#job_artifacts' do
context 'when selective sync is enabled' do
it 'applies project restriction' do
node.update!(selective_sync_type: 'namespaces')
expect(Ci::JobArtifact).to receive(:project_id_in).once.and_call_original
node.job_artifacts
end
end
context 'when selective sync is disabled' do
it 'does not apply project restriction' do
node.update!(selective_sync_type: nil)
expect(Ci::JobArtifact).not_to receive(:project_id_in)
node.job_artifacts
end
end
end
end end
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