2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
describe 'Projects > Files > Download buttons in files tree' do
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:user) { project.creator }
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
let(:pipeline) do
|
2016-09-29 09:46:39 +05:30
|
|
|
create(:ci_pipeline,
|
|
|
|
project: project,
|
|
|
|
sha: project.commit.sha,
|
|
|
|
ref: project.default_branch,
|
2018-10-15 14:42:47 +05:30
|
|
|
status: 'success')
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +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-10-15 14:42:47 +05:30
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2018-10-15 14:42:47 +05:30
|
|
|
project.add_developer(user)
|
2019-12-04 20:38:33 +05:30
|
|
|
end
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
it_behaves_like 'archive download buttons' do
|
|
|
|
let(:path_to_visit) { project_tree_path(project, project.default_branch) }
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
context 'with artifacts' do
|
2019-12-04 20:38:33 +05:30
|
|
|
before do
|
|
|
|
visit project_tree_path(project, project.default_branch)
|
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
it 'shows download artifacts button' do
|
|
|
|
href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build')
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
expect(page).to have_link build.name, href: href
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|