diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-10-05 13:41:22 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-10-05 13:41:22 +0300 |
commit | e4d07f12b65fa8d1753a950a79c985406614c2b1 (patch) | |
tree | 40b6b55712db44475af44b6765244706b61f41c2 /spec/features/projects/artifacts | |
parent | d5486807ba979172e35b81a6b74243225473b69f (diff) |
Test against public projects
Diffstat (limited to 'spec/features/projects/artifacts')
-rw-r--r-- | spec/features/projects/artifacts/browse_spec.rb | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb index fe485334192..cb69aff8d5f 100644 --- a/spec/features/projects/artifacts/browse_spec.rb +++ b/spec/features/projects/artifacts/browse_spec.rb @@ -28,18 +28,40 @@ feature 'Browse artifact', :js do before do allow(Gitlab.config.pages).to receive(:enabled).and_return(true) allow(Gitlab.config.pages).to receive(:artifacts_server).and_return(true) + end + + context 'when the project is public' do + it "shows external link icon and styles" do + visit browse_url + + link = first('.tree-item-file-external-link') - visit browse_url + expect(page).to have_link('doc_sample.txt', href: file_project_job_artifacts_path(project, job, path: txt_entry.blob.path)) + expect(link[:target]).to eq('_blank') + expect(link[:rel]).to include('noopener') + expect(link[:rel]).to include('noreferrer') + expect(page).to have_selector('.js-artifact-tree-external-icon') + end end - it "shows external link icon and styles" do - link = first('.tree-item-file-external-link') + context 'when the project is private' do + let!(:private_project) { create(:project, :private) } + let(:pipeline) { create(:ci_empty_pipeline, project: private_project) } + let(:job) { create(:ci_build, :artifacts, pipeline: pipeline) } + let(:user) { create(:user) } + + before do + private_project.add_developer(user) + + sign_in(user) + end + + it 'shows internal link styles' do + visit browse_project_job_artifacts_path(private_project, job, 'other_artifacts_0.1.2') - expect(page).to have_link('doc_sample.txt', href: file_project_job_artifacts_path(project, job, path: txt_entry.blob.path)) - expect(link[:target]).to eq('_blank') - expect(link[:rel]).to include('noopener') - expect(link[:rel]).to include('noreferrer') - expect(page).to have_selector('.js-artifact-tree-external-icon') + expect(page).to have_link('doc_sample.txt') + expect(page).not_to have_selector('.js-artifact-tree-external-icon') + end end end end |