2015-09-25 12:07:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
describe 'Admin Builds' do
|
2015-09-25 12:07:36 +05:30
|
|
|
before do
|
2015-12-23 02:04:40 +05:30
|
|
|
login_as :admin
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
describe 'GET /admin/builds' do
|
|
|
|
let(:commit) { create(:ci_commit) }
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
context 'All tab' do
|
|
|
|
context 'when have builds' do
|
|
|
|
it 'shows all builds' do
|
|
|
|
create(:ci_build, commit: commit, status: :pending)
|
|
|
|
create(:ci_build, commit: commit, status: :running)
|
|
|
|
create(:ci_build, commit: commit, status: :success)
|
|
|
|
create(:ci_build, commit: commit, status: :failed)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
visit admin_builds_path
|
2015-12-23 02:04:40 +05:30
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
expect(page).to have_selector('.nav-links li.active', text: 'All')
|
2016-06-02 11:05:42 +05:30
|
|
|
expect(page).to have_selector('.row-content-block', text: 'All builds')
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page.all('.build-link').size).to eq(4)
|
|
|
|
expect(page).to have_link 'Cancel all'
|
|
|
|
end
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
context 'when have no builds' do
|
|
|
|
it 'shows a message' do
|
|
|
|
visit admin_builds_path
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
expect(page).to have_selector('.nav-links li.active', text: 'All')
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page).to have_content 'No builds to show'
|
|
|
|
expect(page).not_to have_link 'Cancel all'
|
|
|
|
end
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
context 'Running tab' do
|
|
|
|
context 'when have running builds' do
|
|
|
|
it 'shows running builds' do
|
|
|
|
build1 = create(:ci_build, commit: commit, status: :pending)
|
|
|
|
build2 = create(:ci_build, commit: commit, status: :success)
|
|
|
|
build3 = create(:ci_build, commit: commit, status: :failed)
|
|
|
|
|
|
|
|
visit admin_builds_path(scope: :running)
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
expect(page).to have_selector('.nav-links li.active', text: 'Running')
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page.find('.build-link')).to have_content(build1.id)
|
|
|
|
expect(page.find('.build-link')).not_to have_content(build2.id)
|
|
|
|
expect(page.find('.build-link')).not_to have_content(build3.id)
|
|
|
|
expect(page).to have_link 'Cancel all'
|
|
|
|
end
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
context 'when have no builds running' do
|
|
|
|
it 'shows a message' do
|
|
|
|
create(:ci_build, commit: commit, status: :success)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
visit admin_builds_path(scope: :running)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
expect(page).to have_selector('.nav-links li.active', text: 'Running')
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page).to have_content 'No builds to show'
|
|
|
|
expect(page).not_to have_link 'Cancel all'
|
|
|
|
end
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
context 'Finished tab' do
|
|
|
|
context 'when have finished builds' do
|
|
|
|
it 'shows finished builds' do
|
|
|
|
build1 = create(:ci_build, commit: commit, status: :pending)
|
|
|
|
build2 = create(:ci_build, commit: commit, status: :running)
|
|
|
|
build3 = create(:ci_build, commit: commit, status: :success)
|
|
|
|
|
|
|
|
visit admin_builds_path(scope: :finished)
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
expect(page).to have_selector('.nav-links li.active', text: 'Finished')
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page.find('.build-link')).not_to have_content(build1.id)
|
|
|
|
expect(page.find('.build-link')).not_to have_content(build2.id)
|
|
|
|
expect(page.find('.build-link')).to have_content(build3.id)
|
|
|
|
expect(page).to have_link 'Cancel all'
|
|
|
|
end
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
context 'when have no builds finished' do
|
|
|
|
it 'shows a message' do
|
|
|
|
create(:ci_build, commit: commit, status: :running)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
visit admin_builds_path(scope: :finished)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
expect(page).to have_selector('.nav-links li.active', text: 'Finished')
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page).to have_content 'No builds to show'
|
|
|
|
expect(page).to have_link 'Cancel all'
|
|
|
|
end
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|