diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-10 17:53:42 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-10 17:53:42 +0200 |
commit | 741fb49378abbf66fbd8d6ad27b94f1040bf3123 (patch) | |
tree | 6bc2393e7fd3d8733e0ef8a19c98bd16d2b4fdbd /spec/features/projects/artifacts/browse_spec.rb | |
parent | e678f312923faf9a702e19894175d4cb14f66b5b (diff) | |
parent | 9ac5338b8eb361927ad068486398b92acb0c287e (diff) | |
download | gitlab-ce-741fb49378abbf66fbd8d6ad27b94f1040bf3123.tar.gz |
Merge branch 'master' into bvl-group-trees
Diffstat (limited to 'spec/features/projects/artifacts/browse_spec.rb')
-rw-r--r-- | spec/features/projects/artifacts/browse_spec.rb | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb index 42b47cb3301..cb69aff8d5f 100644 --- a/spec/features/projects/artifacts/browse_spec.rb +++ b/spec/features/projects/artifacts/browse_spec.rb @@ -4,16 +4,15 @@ feature 'Browse artifact', :js do let(:project) { create(:project, :public) } let(:pipeline) { create(:ci_empty_pipeline, project: project) } let(:job) { create(:ci_build, :artifacts, pipeline: pipeline) } + let(:browse_url) do + browse_path('other_artifacts_0.1.2') + end def browse_path(path) browse_project_job_artifacts_path(project, job, path) end context 'when visiting old URL' do - let(:browse_url) do - browse_path('other_artifacts_0.1.2') - end - before do visit browse_url.sub('/-/jobs', '/builds') end @@ -22,4 +21,47 @@ feature 'Browse artifact', :js do expect(page.current_path).to eq(browse_url) end end + + context 'when browsing a directory with an text file' do + let(:txt_entry) { job.artifacts_metadata_entry('other_artifacts_0.1.2/doc_sample.txt') } + + 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') + + 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 + + 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') + expect(page).not_to have_selector('.js-artifact-tree-external-icon') + end + end + end end |