Commit fa864716 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use new "clear all" button in tests

parent b60b9094
require 'spec_helper'
require 'rails_helper'
describe "Admin Projects", feature: true do
describe "Admin::Projects", feature: true do
before do
@project = create(:project)
login_as :admin
......@@ -32,38 +31,4 @@ describe "Admin Projects", feature: true do
expect(page).to have_content(@project.name)
end
end
feature 'repository checks' do
scenario 'trigger repository check' do
visit_admin_project_page
page.within('.repository-check') do
click_button 'Trigger repository check'
end
expect(page).to have_content('Repository check was triggered')
end
scenario 'see failed repository check' do
@project.update_column(:last_repository_check_failed, true)
visit_admin_project_page
expect(page).to have_content('Last repository check failed')
end
scenario 'clear repository checks', js: true do
@project.update_column(:last_repository_check_failed, true)
visit admin_namespaces_projects_path
page.within('.repository-check-states') do
click_link 'Clear all' # pop-up should be auto confirmed
end
expect(@project.reload.last_repository_check_failed).to eq(false)
end
end
def visit_admin_project_page
visit admin_namespace_project_path(@project.namespace, @project)
end
end
require 'rails_helper'
feature 'Admin uses repository checks', feature: true do
before do
login_as :admin
end
scenario 'to trigger a single check' do
project = create(:empty_project)
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
scenario 'to see a single failed repository check' do
visit_admin_project_page(broken_project)
page.within('.alert') do
expect(page.text).to match(/Last repository check \(.* ago\) failed/)
end
end
scenario 'to clear all repository checks', js: true do
project = broken_project
visit admin_application_settings_path
click_link 'Clear all repository checks' # pop-up should be auto confirmed
expect(project.reload.last_repository_check_failed).to eq(false)
end
def visit_admin_project_page(project)
visit admin_namespace_project_path(project.namespace, project)
end
def broken_project
project = create(:empty_project)
project.update_columns(
last_repository_check_failed: true,
last_repository_check_at: Time.now,
)
project
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment