summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-04-13 12:13:53 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-04-13 12:13:53 +0200
commitfa864716a80eba26f75a1d69ca3e5183bee96542 (patch)
treea11fa51f797ed8972cab464d1be47a3f23c446d5
parentb60b9094d3581e72fa614771456fa9003bee6426 (diff)
downloadgitlab-ce-fa864716a80eba26f75a1d69ca3e5183bee96542.tar.gz
Use new "clear all" button in tests
-rw-r--r--spec/features/admin/admin_projects_spec.rb37
-rw-r--r--spec/features/admin/admin_uses_repository_checks_spec.rb48
2 files changed, 49 insertions, 36 deletions
diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb
index 95a230a72c3..101d955d693 100644
--- a/spec/features/admin/admin_projects_spec.rb
+++ b/spec/features/admin/admin_projects_spec.rb
@@ -1,7 +1,6 @@
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
diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb
new file mode 100644
index 00000000000..69b82441916
--- /dev/null
+++ b/spec/features/admin/admin_uses_repository_checks_spec.rb
@@ -0,0 +1,48 @@
+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