BigW Consortium Gitlab

download_buttons_spec.rb 1.04 KB
Newer Older
1 2
require 'spec_helper'

3
feature 'Download buttons in files tree' do
4 5 6
  given(:user) { create(:user) }
  given(:role) { :developer }
  given(:status) { 'success' }
7
  given(:project) { create(:project, :repository) }
8

9
  given(:pipeline) do
10 11 12 13 14
    create(:ci_pipeline,
           project: project,
           sha: project.commit.sha,
           ref: project.default_branch,
           status: status)
15
  end
16

17 18 19 20 21 22 23 24
  given!(:build) do
    create(:ci_build, :success, :artifacts,
           pipeline: pipeline,
           status: pipeline.status,
           name: 'build')
  end

  background do
25
    sign_in(user)
26 27 28 29 30 31
    project.team << [user, role]
  end

  describe 'when files tree' do
    context 'with artifacts' do
      before do
32
        visit project_tree_path(project, project.default_branch)
33 34 35
      end

      scenario 'shows download artifacts button' do
36
        href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build')
37 38

        expect(page).to have_link "Download '#{build.name}'", href: href
39 40 41 42
      end
    end
  end
end