Added extra condition for BuildLists::CleanBuildrootJob

This commit is contained in:
Vokhmin Alexey V 2014-09-29 21:55:51 +04:00
parent ff46ce1020
commit 6b1e16cf6a
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@ module BuildLists
def self.perform
build_lists = BuildList.where(save_buildroot: true).
for_status(BuildList::BUILD_ERROR).
where('updated_at < ?', Time.now - 1.hour).
where('results ~ ?', "file_name: #{FILENAME}")

View File

@ -6,7 +6,7 @@ describe BuildLists::CleanBuildrootJob do
subject { BuildLists::CleanBuildrootJob }
it 'ensures that not raises error' do
FactoryGirl.create(:build_list)
FactoryGirl.create(:build_list, status: BuildList::BUILD_ERROR)
expect(FileStoreService::File).to_not receive(:new)
expect do
subject.perform
@ -20,11 +20,13 @@ describe BuildLists::CleanBuildrootJob do
]
FactoryGirl.create(:build_list,
results: results,
save_buildroot: true
save_buildroot: true,
status: BuildList::BUILD_ERROR
)
bl = FactoryGirl.create(:build_list,
results: results,
save_buildroot: true,
status: BuildList::BUILD_ERROR,
updated_at: Time.now - 2.hours
)
file_store_service = double(:file_store_service, destroy: true)