Commit 045dad3c authored by Lin Jen-Shin's avatar Lin Jen-Shin

Test for enabling/disabling runners from admin runner page

parent dbd534a8
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
.col-md-6 .col-md-6
%h4 Restrict projects for this runner %h4 Restrict projects for this runner
- if @runner.projects.any? - if @runner.projects.any?
%table.table %table.table.assigned-projects
%thead %thead
%tr %tr
%th Assigned projects %th Assigned projects
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
.pull-right .pull-right
= link_to 'Disable', [:admin, project.namespace.becomes(Namespace), project, runner_project], method: :delete, class: 'btn btn-danger btn-xs' = link_to 'Disable', [:admin, project.namespace.becomes(Namespace), project, runner_project], method: :delete, class: 'btn btn-danger btn-xs'
%table.table %table.table.unassigned-projects
%thead %thead
%tr %tr
%th Project %th Project
......
...@@ -60,6 +60,40 @@ describe "Admin Runners" do ...@@ -60,6 +60,40 @@ describe "Admin Runners" do
it { expect(page).to have_content(@project1.name_with_namespace) } it { expect(page).to have_content(@project1.name_with_namespace) }
it { expect(page).not_to have_content(@project2.name_with_namespace) } it { expect(page).not_to have_content(@project2.name_with_namespace) }
end end
describe 'enable/create' do
before do
@project1.runners << runner
visit admin_runner_path(runner)
end
it 'enables specific runner for project' do
within '.unassigned-projects' do
click_on 'Enable'
end
assigned_project = page.find('.assigned-projects')
expect(assigned_project).to have_content(@project2.path)
end
end
describe 'disable/destroy' do
before do
@project1.runners << runner
visit admin_runner_path(runner)
end
it 'enables specific runner for project' do
within '.assigned-projects' do
click_on 'Disable'
end
new_runner_project = page.find('.unassigned-projects')
expect(new_runner_project).to have_content(@project1.path)
end
end
end end
describe 'runners registration token' do describe 'runners registration token' do
......
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