Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/models/lockfile_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions spec/models/lockfile_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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