2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-07-25 08:52:18 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Projects > Files > Download buttons in files tree' do
|
2018-04-06 08:40:33 -04:00
|
|
|
let(:project) { create(:project, :repository) }
|
2018-04-09 13:26:29 -04:00
|
|
|
let(:user) { project.creator }
|
2016-08-10 06:57:51 -04:00
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
let(:pipeline) do
|
2016-08-10 06:57:51 -04:00
|
|
|
create(:ci_pipeline,
|
|
|
|
project: project,
|
|
|
|
sha: project.commit.sha,
|
|
|
|
ref: project.default_branch,
|
2018-04-09 13:26:29 -04:00
|
|
|
status: 'success')
|
2016-07-25 08:52:18 -04:00
|
|
|
end
|
2016-08-10 06:57:51 -04:00
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
let!(:build) do
|
2016-07-25 08:52:18 -04:00
|
|
|
create(:ci_build, :success, :artifacts,
|
|
|
|
pipeline: pipeline,
|
|
|
|
status: pipeline.status,
|
|
|
|
name: 'build')
|
|
|
|
end
|
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2018-04-09 13:26:29 -04:00
|
|
|
project.add_developer(user)
|
2019-07-22 10:56:40 -04:00
|
|
|
end
|
2016-07-25 08:52:18 -04:00
|
|
|
|
2019-07-22 10:56:40 -04:00
|
|
|
it_behaves_like 'archive download buttons' do
|
|
|
|
let(:path_to_visit) { project_tree_path(project, project.default_branch) }
|
2018-04-09 13:26:29 -04:00
|
|
|
end
|
2016-07-25 08:52:18 -04:00
|
|
|
|
2018-04-09 13:26:29 -04:00
|
|
|
context 'with artifacts' do
|
2019-07-22 10:56:40 -04:00
|
|
|
before do
|
|
|
|
visit project_tree_path(project, project.default_branch)
|
|
|
|
end
|
|
|
|
|
2018-04-09 13:26:29 -04:00
|
|
|
it 'shows download artifacts button' do
|
|
|
|
href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build')
|
2016-09-19 01:12:45 -04:00
|
|
|
|
2019-04-11 10:03:02 -04:00
|
|
|
expect(page).to have_link build.name, href: href
|
2016-07-25 08:52:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|