2016-09-29 09:46:39 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Download buttons in branches page' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:role) { :developer }
|
|
|
|
let(:status) { 'success' }
|
|
|
|
let(:project) { create(:project, :repository) }
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:pipeline) do
|
2016-09-29 09:46:39 +05:30
|
|
|
create(:ci_pipeline,
|
|
|
|
project: project,
|
|
|
|
sha: project.commit('binary-encoding').sha,
|
|
|
|
ref: 'binary-encoding', # make sure the branch is in the 1st page!
|
|
|
|
status: status)
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
let!(:build) do
|
2016-09-29 09:46:39 +05:30
|
|
|
create(:ci_build, :success, :artifacts,
|
|
|
|
pipeline: pipeline,
|
|
|
|
status: pipeline.status,
|
|
|
|
name: 'build')
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
project.add_role(user, role)
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when checking branches' do
|
|
|
|
context 'with artifacts' do
|
|
|
|
before do
|
2018-03-27 19:54:05 +05:30
|
|
|
visit project_branches_filtered_path(project, state: 'all', search: 'binary-encoding')
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'shows download artifacts button' do
|
2017-09-10 17:25:29 +05:30
|
|
|
href = latest_succeeded_project_artifacts_path(project, 'binary-encoding/download', job: 'build')
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
expect(page).to have_link "Download '#{build.name}'", href: href
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|