2016-04-13 10:13:53 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-07-05 06:32:05 +00:00
|
|
|
describe 'Admin uses repository checks' do
|
2017-01-22 00:11:19 +00:00
|
|
|
include StubENV
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(create(:admin))
|
2017-01-22 00:11:19 +00:00
|
|
|
end
|
2016-04-13 10:13:53 +00:00
|
|
|
|
2018-07-05 06:32:05 +00:00
|
|
|
it 'to trigger a single check' do
|
2017-08-02 19:55:11 +00:00
|
|
|
project = create(:project)
|
2016-04-13 10:13:53 +00:00
|
|
|
visit_admin_project_page(project)
|
|
|
|
|
|
|
|
page.within('.repository-check') do
|
|
|
|
click_button 'Trigger repository check'
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content('Repository check was triggered')
|
|
|
|
end
|
|
|
|
|
2018-07-05 06:32:05 +00:00
|
|
|
it 'to see a single failed repository check', :js do
|
2017-08-02 19:55:11 +00:00
|
|
|
project = create(:project)
|
2016-04-13 13:56:05 +00:00
|
|
|
project.update_columns(
|
|
|
|
last_repository_check_failed: true,
|
2017-05-03 11:27:17 +00:00
|
|
|
last_repository_check_at: Time.now
|
2016-04-13 13:56:05 +00:00
|
|
|
)
|
|
|
|
visit_admin_project_page(project)
|
2016-04-13 10:13:53 +00:00
|
|
|
|
|
|
|
page.within('.alert') do
|
2018-06-03 14:45:26 +00:00
|
|
|
expect(page.text).to match(/Last repository check \(just now\) failed/)
|
2016-04-13 10:13:53 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-05 06:32:05 +00:00
|
|
|
it 'to clear all repository checks', :js do
|
2016-04-13 10:13:53 +00:00
|
|
|
visit admin_application_settings_path
|
2017-01-22 00:11:19 +00:00
|
|
|
|
2016-04-13 13:56:05 +00:00
|
|
|
expect(RepositoryCheck::ClearWorker).to receive(:perform_async)
|
2016-04-13 10:13:53 +00:00
|
|
|
|
2017-10-03 17:05:57 +00:00
|
|
|
accept_confirm { find(:link, 'Clear all repository checks').send_keys(:return) }
|
2016-04-13 10:13:53 +00:00
|
|
|
|
2016-04-13 13:56:05 +00:00
|
|
|
expect(page).to have_content('Started asynchronous removal of all repository check states.')
|
2016-04-13 10:13:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def visit_admin_project_page(project)
|
2017-07-06 16:20:50 +00:00
|
|
|
visit admin_project_path(project)
|
2016-04-13 10:13:53 +00:00
|
|
|
end
|
|
|
|
end
|