diff --git a/app/models/lockfile_check.rb b/app/models/lockfile_check.rb index 7b767c2..5888cde 100644 --- a/app/models/lockfile_check.rb +++ b/app/models/lockfile_check.rb @@ -38,6 +38,10 @@ def self.create_for!(lockfile:, rails_release:) def enqueue_gem_checks ids = gem_checks.where(status: "pending").pluck(:id) - Checks::ResolveGem.perform_bulk(ids.map { [_1] }) if ids.any? + if ids.any? + Checks::ResolveGem.perform_bulk(ids.map { [_1] }) + else + complete! + end end end diff --git a/spec/models/lockfile_check_spec.rb b/spec/models/lockfile_check_spec.rb index 3a2ca5e..c28aecd 100644 --- a/spec/models/lockfile_check_spec.rb +++ b/spec/models/lockfile_check_spec.rb @@ -110,5 +110,18 @@ def create_lockfile(**kwargs) expect(Checks::ResolveGem).not_to have_received(:perform_bulk) end + + it "sets status to completed if there are no gem_checks to enqueue" do + lockfile_check = FactoryBot.create(:lockfile_check) + FactoryBot.create(:gem_check, + lockfile_check: lockfile_check, + gem_name: "puma", + status: "complete", + result: "skipped") + + lockfile_check.enqueue_gem_checks + + expect(lockfile_check).to be_complete + end end end