Add coverage for malformed version cleanup in SoftwareUpdateCheckService
, add helper query methods (#32876)
This commit is contained in:
parent
62d65504f6
commit
766358e52b
4 changed files with 73 additions and 4 deletions
|
@ -27,6 +27,7 @@ RSpec.describe SoftwareUpdateCheckService do
|
|||
before do
|
||||
Fabricate(:software_update, version: '3.5.0', type: 'major', urgent: false)
|
||||
Fabricate(:software_update, version: '42.13.12', type: 'major', urgent: false)
|
||||
Fabricate(:software_update, version: 'Malformed', type: 'major', urgent: false)
|
||||
|
||||
owner_user.settings.update('notification_emails.software_updates': 'all')
|
||||
owner_user.save!
|
||||
|
@ -50,7 +51,7 @@ RSpec.describe SoftwareUpdateCheckService do
|
|||
end
|
||||
|
||||
it 'deletes outdated update records but keeps valid update records' do
|
||||
expect { subject.call }.to change { SoftwareUpdate.pluck(:version).sort }.from(['3.5.0', '42.13.12']).to(['42.13.12'])
|
||||
expect { subject.call }.to change { SoftwareUpdate.pluck(:version).sort }.from(['3.5.0', '42.13.12', 'Malformed']).to(['42.13.12'])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -85,7 +86,7 @@ RSpec.describe SoftwareUpdateCheckService do
|
|||
end
|
||||
|
||||
it 'updates the list of known updates' do
|
||||
expect { subject.call }.to change { SoftwareUpdate.pluck(:version).sort }.from(['3.5.0', '42.13.12']).to(['4.2.1', '4.3.0', '5.0.0'])
|
||||
expect { subject.call }.to change { SoftwareUpdate.pluck(:version).sort }.from(['3.5.0', '42.13.12', 'Malformed']).to(['4.2.1', '4.3.0', '5.0.0'])
|
||||
end
|
||||
|
||||
context 'when no update is urgent' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue