diff options
Diffstat (limited to 'spec/views')
58 files changed, 355 insertions, 0 deletions
diff --git a/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb new file mode 100644 index 00000000000..3029bfb6df5 --- /dev/null +++ b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'admin/application_settings/_repository_storage.html.haml' do + let(:app_settings) { build(:application_setting) } + let(:storages) do + { + "mepmep" => { "path" => "/tmp" }, + "foobar" => { "path" => "/tmp" } + } + end + + before do + assign(:application_setting, app_settings) + stub_storage_settings(storages) + end + + context 'when multiple storages are available' do + it 'lists them all' do + render + + storages.keys.each do |storage_name| + expect(rendered).to have_content(storage_name) + end + end + end +end diff --git a/spec/views/admin/dashboard/index.html.haml_spec.rb b/spec/views/admin/dashboard/index.html.haml_spec.rb index 0e8b7c82d3a..93fedde6e96 100644 --- a/spec/views/admin/dashboard/index.html.haml_spec.rb +++ b/spec/views/admin/dashboard/index.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'admin/dashboard/index.html.haml' do @@ -15,6 +17,7 @@ describe 'admin/dashboard/index.html.haml' do allow(view).to receive(:admin?).and_return(true) allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:show_license_breakdown?).and_return(false) end it "shows version of GitLab Workhorse" do diff --git a/spec/views/admin/sessions/new.html.haml_spec.rb b/spec/views/admin/sessions/new.html.haml_spec.rb new file mode 100644 index 00000000000..57255748988 --- /dev/null +++ b/spec/views/admin/sessions/new.html.haml_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'admin/sessions/new.html.haml' do + context 'admin has password set' do + before do + allow(view).to receive(:password_authentication_enabled_for_web?).and_return(true) + end + + it "shows enter password form" do + render + + expect(rendered).to have_css('#login-pane.active') + expect(rendered).to have_selector('input[name="password"]') + end + end + + context 'admin has no password set' do + before do + allow(view).to receive(:password_authentication_enabled_for_web?).and_return(false) + end + + it "warns authentication not possible" do + render + + expect(rendered).not_to have_css('#login-pane') + expect(rendered).to have_content 'No authentication methods configured' + end + end +end diff --git a/spec/views/ci/status/_badge.html.haml_spec.rb b/spec/views/ci/status/_badge.html.haml_spec.rb index 49f57969239..59db828a0c7 100644 --- a/spec/views/ci/status/_badge.html.haml_spec.rb +++ b/spec/views/ci/status/_badge.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ci/status/_badge' do diff --git a/spec/views/dashboard/projects/_blank_state_admin_welcome.haml_spec.rb b/spec/views/dashboard/projects/_blank_state_admin_welcome.haml_spec.rb index 2f58eec86dc..bc92278bb22 100644 --- a/spec/views/dashboard/projects/_blank_state_admin_welcome.haml_spec.rb +++ b/spec/views/dashboard/projects/_blank_state_admin_welcome.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'dashboard/projects/_blank_state_admin_welcome.html.haml' do diff --git a/spec/views/dashboard/projects/_nav.html.haml_spec.rb b/spec/views/dashboard/projects/_nav.html.haml_spec.rb index cbdd3c0acc3..61b6bfef120 100644 --- a/spec/views/dashboard/projects/_nav.html.haml_spec.rb +++ b/spec/views/dashboard/projects/_nav.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'dashboard/projects/_nav.html.haml' do diff --git a/spec/views/devise/shared/_signin_box.html.haml_spec.rb b/spec/views/devise/shared/_signin_box.html.haml_spec.rb index 0563984a03c..f8867477603 100644 --- a/spec/views/devise/shared/_signin_box.html.haml_spec.rb +++ b/spec/views/devise/shared/_signin_box.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'devise/shared/_signin_box' do @@ -8,6 +10,7 @@ describe 'devise/shared/_signin_box' do allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) allow(view).to receive(:captcha_enabled?).and_return(false) allow(view).to receive(:captcha_on_login_required?).and_return(false) + allow(view).to receive(:experiment_enabled?).and_return(false) end it 'is shown when Crowd is enabled' do diff --git a/spec/views/errors/access_denied.html.haml_spec.rb b/spec/views/errors/access_denied.html.haml_spec.rb index bde2f6f0169..b2e82847ab9 100644 --- a/spec/views/errors/access_denied.html.haml_spec.rb +++ b/spec/views/errors/access_denied.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'errors/access_denied' do diff --git a/spec/views/events/event/_push.html.haml_spec.rb b/spec/views/events/event/_push.html.haml_spec.rb index f5634de4916..d33a8aa86fc 100644 --- a/spec/views/events/event/_push.html.haml_spec.rb +++ b/spec/views/events/event/_push.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'events/event/_push.html.haml' do @@ -26,6 +28,23 @@ describe 'events/event/_push.html.haml' do expect(rendered).not_to have_link(event.ref_name) end end + + context 'ref_count is more than 1' do + let(:payload) do + build_stubbed( + :push_event_payload, + event: event, + ref_count: 4, + ref_type: :branch + ) + end + + it 'includes the count in the text' do + render partial: 'events/event/push', locals: { event: event } + + expect(rendered).to include('4 branches') + end + end end context 'with a tag' do @@ -51,5 +70,22 @@ describe 'events/event/_push.html.haml' do expect(rendered).not_to have_link(event.ref_name) end end + + context 'ref_count is more than 1' do + let(:payload) do + build_stubbed( + :push_event_payload, + event: event, + ref_count: 4, + ref_type: :tag + ) + end + + it 'includes the count in the text' do + render partial: 'events/event/push', locals: { event: event } + + expect(rendered).to include('4 tags') + end + end end end diff --git a/spec/views/groups/_home_panel.html.haml_spec.rb b/spec/views/groups/_home_panel.html.haml_spec.rb index 91c5ca261b9..8960dfa67db 100644 --- a/spec/views/groups/_home_panel.html.haml_spec.rb +++ b/spec/views/groups/_home_panel.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'groups/_home_panel' do diff --git a/spec/views/groups/edit.html.haml_spec.rb b/spec/views/groups/edit.html.haml_spec.rb index 0da3470433c..9fc850841ee 100644 --- a/spec/views/groups/edit.html.haml_spec.rb +++ b/spec/views/groups/edit.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'groups/edit.html.haml' do diff --git a/spec/views/help/instance_configuration.html.haml_spec.rb b/spec/views/help/instance_configuration.html.haml_spec.rb index 18628ddebf7..81d569b5cf4 100644 --- a/spec/views/help/instance_configuration.html.haml_spec.rb +++ b/spec/views/help/instance_configuration.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'help/instance_configuration' do diff --git a/spec/views/layouts/_head.html.haml_spec.rb b/spec/views/layouts/_head.html.haml_spec.rb index d7f24950e6f..e9b3334fffc 100644 --- a/spec/views/layouts/_head.html.haml_spec.rb +++ b/spec/views/layouts/_head.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'layouts/_head' do @@ -5,6 +7,7 @@ describe 'layouts/_head' do before do allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:experiment_enabled?).and_return(false) end it 'escapes HTML-safe strings in page_title' do diff --git a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb index bf63021a7fa..9ec65dba586 100644 --- a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'layouts/nav/sidebar/_admin' do diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index b627b9dba59..7decfa58153 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'layouts/nav/sidebar/_project' do diff --git a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb index bf633a118ca..b821b015c97 100644 --- a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'notify/pipeline_failed_email.html.haml' do @@ -33,6 +35,8 @@ describe 'notify/pipeline_failed_email.html.haml' do expect(rendered).to have_content "##{pipeline.id}" expect(rendered).to have_content pipeline.user.name end + + it_behaves_like 'correct pipeline information for pipelines for merge requests' end context 'pipeline without user' do diff --git a/spec/views/notify/pipeline_failed_email.text.erb_spec.rb b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb index 060274eb56a..d15969acf83 100644 --- a/spec/views/notify/pipeline_failed_email.text.erb_spec.rb +++ b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb @@ -36,4 +36,6 @@ describe 'notify/pipeline_failed_email.text.erb' do expect(rendered).to have_content(pipeline.user.name) expect(rendered).to have_content("/-/jobs/#{job.id}/raw") end + + it_behaves_like 'correct pipeline information for pipelines for merge requests' end diff --git a/spec/views/notify/pipeline_success_email.html.haml_spec.rb b/spec/views/notify/pipeline_success_email.html.haml_spec.rb index 46a6c908863..fbf33b7ec35 100644 --- a/spec/views/notify/pipeline_success_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_success_email.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'notify/pipeline_success_email.html.haml' do @@ -33,6 +35,8 @@ describe 'notify/pipeline_success_email.html.haml' do expect(rendered).to have_content "##{pipeline.id}" expect(rendered).to have_content pipeline.user.name end + + it_behaves_like 'correct pipeline information for pipelines for merge requests' end context 'pipeline without user' do diff --git a/spec/views/notify/pipeline_success_email.text.erb_spec.rb b/spec/views/notify/pipeline_success_email.text.erb_spec.rb new file mode 100644 index 00000000000..ba4633bc346 --- /dev/null +++ b/spec/views/notify/pipeline_success_email.text.erb_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'notify/pipeline_success_email.text.erb' do + let(:user) { create(:user, developer_projects: [project]) } + let(:project) { create(:project, :repository) } + let(:merge_request) { create(:merge_request, :simple, source_project: project) } + + let(:pipeline) do + create(:ci_pipeline, + :success, + project: project, + user: user, + ref: project.default_branch, + sha: project.commit.sha) + end + + before do + assign(:project, project) + assign(:pipeline, pipeline) + assign(:merge_request, merge_request) + end + + it_behaves_like 'correct pipeline information for pipelines for merge requests' +end diff --git a/spec/views/profiles/show.html.haml_spec.rb b/spec/views/profiles/show.html.haml_spec.rb index 9e7ac0b84fa..592b3a56ba3 100644 --- a/spec/views/profiles/show.html.haml_spec.rb +++ b/spec/views/profiles/show.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'profiles/show' do diff --git a/spec/views/projects/_home_panel.html.haml_spec.rb b/spec/views/projects/_home_panel.html.haml_spec.rb index 12925a5ab07..4d5b369e88e 100644 --- a/spec/views/projects/_home_panel.html.haml_spec.rb +++ b/spec/views/projects/_home_panel.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/_home_panel' do diff --git a/spec/views/projects/artifacts/_artifact.html.haml_spec.rb b/spec/views/projects/artifacts/_artifact.html.haml_spec.rb new file mode 100644 index 00000000000..460b63efa2f --- /dev/null +++ b/spec/views/projects/artifacts/_artifact.html.haml_spec.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe "projects/artifacts/_artifact.html.haml" do + let(:project) { create(:project) } + + describe 'delete button' do + before do + create(:ci_build, :artifacts, project: project) + + allow(view).to receive(:current_user).and_return(user) + assign(:project, project) + end + + context 'with admin' do + let(:user) { build(:admin) } + + it 'has a delete button' do + render_partial + + expect(rendered).to have_link('Delete artifacts', href: project_artifact_path(project, project.job_artifacts.first)) + end + end + + context 'with owner' do + let(:user) { create(:user) } + let(:project) { build(:project, namespace: user.namespace) } + + it 'has a delete button' do + render_partial + + expect(rendered).to have_link('Delete artifacts', href: project_artifact_path(project, project.job_artifacts.first)) + end + end + + context 'with master' do + let(:user) { create(:user) } + + it 'has a delete button' do + allow_any_instance_of(ProjectTeam).to receive(:max_member_access).and_return(Gitlab::Access::MASTER) + render_partial + + expect(rendered).to have_link('Delete artifacts', href: project_artifact_path(project, project.job_artifacts.first)) + end + end + + context 'with developer' do + let(:user) { build(:user) } + + it 'has no delete button' do + project.add_developer(user) + render_partial + + expect(rendered).not_to have_link('Delete artifacts') + end + end + + context 'with reporter' do + let(:user) { build(:user) } + + it 'has no delete button' do + project.add_reporter(user) + render_partial + + expect(rendered).not_to have_link('Delete artifacts') + end + end + end + + def render_partial + render partial: 'projects/artifacts/artifact', collection: project.job_artifacts, as: :artifact + end +end diff --git a/spec/views/projects/blob/_viewer.html.haml_spec.rb b/spec/views/projects/blob/_viewer.html.haml_spec.rb index 95f7f87d37b..a798a72fa76 100644 --- a/spec/views/projects/blob/_viewer.html.haml_spec.rb +++ b/spec/views/projects/blob/_viewer.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/blob/_viewer.html.haml' do diff --git a/spec/views/projects/buttons/_dropdown.html.haml_spec.rb b/spec/views/projects/buttons/_dropdown.html.haml_spec.rb index 8b9aab30286..2bc1de040d5 100644 --- a/spec/views/projects/buttons/_dropdown.html.haml_spec.rb +++ b/spec/views/projects/buttons/_dropdown.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/buttons/_dropdown' do diff --git a/spec/views/projects/ci/lints/show.html.haml_spec.rb b/spec/views/projects/ci/lints/show.html.haml_spec.rb index 2f0cd38c14a..ea67478ff98 100644 --- a/spec/views/projects/ci/lints/show.html.haml_spec.rb +++ b/spec/views/projects/ci/lints/show.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/ci/lints/show' do diff --git a/spec/views/projects/commit/_commit_box.html.haml_spec.rb b/spec/views/projects/commit/_commit_box.html.haml_spec.rb index 1086546c10d..07c530670d2 100644 --- a/spec/views/projects/commit/_commit_box.html.haml_spec.rb +++ b/spec/views/projects/commit/_commit_box.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/commit/_commit_box.html.haml' do diff --git a/spec/views/projects/commit/branches.html.haml_spec.rb b/spec/views/projects/commit/branches.html.haml_spec.rb index b9d4dc80fe0..36da489a84f 100644 --- a/spec/views/projects/commit/branches.html.haml_spec.rb +++ b/spec/views/projects/commit/branches.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/commit/branches.html.haml' do diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb index d07099489e5..af28a8f9193 100644 --- a/spec/views/projects/commit/show.html.haml_spec.rb +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/commit/show.html.haml' do diff --git a/spec/views/projects/commits/_commit.html.haml_spec.rb b/spec/views/projects/commits/_commit.html.haml_spec.rb index 6bf1b5fd2d0..669bb596de5 100644 --- a/spec/views/projects/commits/_commit.html.haml_spec.rb +++ b/spec/views/projects/commits/_commit.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/commits/_commit.html.haml' do diff --git a/spec/views/projects/diffs/_stats.html.haml_spec.rb b/spec/views/projects/diffs/_stats.html.haml_spec.rb index c7d2f85747c..eb853596f98 100644 --- a/spec/views/projects/diffs/_stats.html.haml_spec.rb +++ b/spec/views/projects/diffs/_stats.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/diffs/_stats.html.haml' do diff --git a/spec/views/projects/diffs/_viewer.html.haml_spec.rb b/spec/views/projects/diffs/_viewer.html.haml_spec.rb index 8ac32db5585..1d5d6e1e78d 100644 --- a/spec/views/projects/diffs/_viewer.html.haml_spec.rb +++ b/spec/views/projects/diffs/_viewer.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/diffs/_viewer.html.haml' do diff --git a/spec/views/projects/edit.html.haml_spec.rb b/spec/views/projects/edit.html.haml_spec.rb index 5c6b2e4b042..f576093ab45 100644 --- a/spec/views/projects/edit.html.haml_spec.rb +++ b/spec/views/projects/edit.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/edit' do diff --git a/spec/views/projects/environments/terminal.html.haml_spec.rb b/spec/views/projects/environments/terminal.html.haml_spec.rb index d2e47225226..b0b08a84f8d 100644 --- a/spec/views/projects/environments/terminal.html.haml_spec.rb +++ b/spec/views/projects/environments/terminal.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/environments/terminal' do diff --git a/spec/views/projects/imports/new.html.haml_spec.rb b/spec/views/projects/imports/new.html.haml_spec.rb index 11fe144d1d2..6cca369b9f6 100644 --- a/spec/views/projects/imports/new.html.haml_spec.rb +++ b/spec/views/projects/imports/new.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "spec_helper" describe "projects/imports/new.html.haml" do diff --git a/spec/views/projects/issues/_related_branches.html.haml_spec.rb b/spec/views/projects/issues/_related_branches.html.haml_spec.rb index 5cff7694029..a6817e3fdbf 100644 --- a/spec/views/projects/issues/_related_branches.html.haml_spec.rb +++ b/spec/views/projects/issues/_related_branches.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/issues/_related_branches' do diff --git a/spec/views/projects/jobs/_build.html.haml_spec.rb b/spec/views/projects/jobs/_build.html.haml_spec.rb index 1d58891036e..681df77ea99 100644 --- a/spec/views/projects/jobs/_build.html.haml_spec.rb +++ b/spec/views/projects/jobs/_build.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/ci/jobs/_build' do diff --git a/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb b/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb index dc2ffc9dc47..f193ce0a552 100644 --- a/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb +++ b/spec/views/projects/jobs/_generic_commit_status.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/generic_commit_statuses/_generic_commit_status.html.haml' do diff --git a/spec/views/projects/jobs/show.html.haml_spec.rb b/spec/views/projects/jobs/show.html.haml_spec.rb index e06a9ecb98b..903a16d9e53 100644 --- a/spec/views/projects/jobs/show.html.haml_spec.rb +++ b/spec/views/projects/jobs/show.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/jobs/show' do diff --git a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb index a7628548de6..71d74b06f85 100644 --- a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/merge_requests/_commits.html.haml' do diff --git a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb index 88c4b52b3a6..f7db4a4d614 100644 --- a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/merge_requests/creations/_new_submit.html.haml' do diff --git a/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb b/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb index e7c40421f1f..a82ef3c04b5 100644 --- a/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/diffs/_diffs.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/merge_requests/diffs/_diffs.html.haml' do diff --git a/spec/views/projects/merge_requests/edit.html.haml_spec.rb b/spec/views/projects/merge_requests/edit.html.haml_spec.rb index 0a3a46210ed..74d9067076c 100644 --- a/spec/views/projects/merge_requests/edit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/edit.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/merge_requests/edit.html.haml' do diff --git a/spec/views/projects/merge_requests/show.html.haml_spec.rb b/spec/views/projects/merge_requests/show.html.haml_spec.rb index 23cb319a202..6023527cb28 100644 --- a/spec/views/projects/merge_requests/show.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/merge_requests/show.html.haml' do diff --git a/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb b/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb index ae47f364296..a07523a4423 100644 --- a/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb +++ b/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/notes/_more_actions_dropdown' do diff --git a/spec/views/projects/pages_domains/show.html.haml_spec.rb b/spec/views/projects/pages_domains/show.html.haml_spec.rb index da27a04bfe9..ba0544a49b0 100644 --- a/spec/views/projects/pages_domains/show.html.haml_spec.rb +++ b/spec/views/projects/pages_domains/show.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/pages_domains/show' do diff --git a/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb b/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb index 5d60d6bc5e7..daf799ec13f 100644 --- a/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb +++ b/spec/views/projects/pipeline_schedules/_pipeline_schedule.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/pipeline_schedules/_pipeline_schedule' do diff --git a/spec/views/projects/pipelines/_stage.html.haml_spec.rb b/spec/views/projects/pipelines/_stage.html.haml_spec.rb index e40e16e742b..591602859c3 100644 --- a/spec/views/projects/pipelines/_stage.html.haml_spec.rb +++ b/spec/views/projects/pipelines/_stage.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/pipelines/_stage' do diff --git a/spec/views/projects/services/_form.haml_spec.rb b/spec/views/projects/services/_form.haml_spec.rb index 06e159f103b..272ac97604a 100644 --- a/spec/views/projects/services/_form.haml_spec.rb +++ b/spec/views/projects/services/_form.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/services/_form' do diff --git a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb index 697e44be065..94a85486cfa 100644 --- a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb +++ b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/settings/ci_cd/_autodevops_form' do diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb index 34355e27544..66be085c290 100644 --- a/spec/views/projects/tags/index.html.haml_spec.rb +++ b/spec/views/projects/tags/index.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/tags/index' do @@ -23,6 +25,11 @@ describe 'projects/tags/index' do expect(rendered).to have_button('Last updated') end + it 'renders links to the Releases page for tags associated with a release' do + render + expect(rendered).to have_link(release.name, href: project_releases_path(project, anchor: release.tag)) + end + context 'when the most recent build for a tag has artifacts' do let!(:build) { create(:ci_build, :success, :artifacts, pipeline: pipeline) } diff --git a/spec/views/projects/tree/_tree_header.html.haml_spec.rb b/spec/views/projects/tree/_tree_header.html.haml_spec.rb new file mode 100644 index 00000000000..4b71ea9ffe3 --- /dev/null +++ b/spec/views/projects/tree/_tree_header.html.haml_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'projects/tree/_tree_header' do + let(:project) { create(:project, :repository) } + let(:current_user) { create(:user) } + let(:repository) { project.repository } + + before do + assign(:project, project) + assign(:repository, repository) + assign(:id, File.join('master', '')) + assign(:ref, 'master') + + allow(view).to receive(:current_user).and_return(current_user) + allow(view).to receive(:can_collaborate_with_project?) { true } + end + + it 'does not render the WebIDE button when user cannot create fork or cannot open MR' do + allow(view).to receive(:can?) { false } + + render + + expect(rendered).not_to have_link('Web IDE') + end + + it 'renders the WebIDE button when user can create fork and can open MR in project' do + allow(view).to receive(:can?) { true } + + render + + expect(rendered).to have_link('Web IDE') + end + + it 'opens a popup confirming a fork if the user can create fork/MR but cannot collaborate with the project' do + allow(view).to receive(:can?) { true } + allow(view).to receive(:can_collaborate_with_project?) { false } + + render + + expect(rendered).to have_link('Web IDE', href: '#modal-confirm-fork') + end +end diff --git a/spec/views/projects/tree/_tree_row.html.haml_spec.rb b/spec/views/projects/tree/_tree_row.html.haml_spec.rb index 3353b7665e2..ff2fe8aeb6c 100644 --- a/spec/views/projects/tree/_tree_row.html.haml_spec.rb +++ b/spec/views/projects/tree/_tree_row.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/tree/_tree_row' do diff --git a/spec/views/projects/tree/show.html.haml_spec.rb b/spec/views/projects/tree/show.html.haml_spec.rb index 5bb0173ab89..960cf42a793 100644 --- a/spec/views/projects/tree/show.html.haml_spec.rb +++ b/spec/views/projects/tree/show.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'projects/tree/show' do diff --git a/spec/views/shared/milestones/_issuable.html.haml_spec.rb b/spec/views/shared/milestones/_issuable.html.haml_spec.rb index 0a3f877cae0..3c2b7c6305a 100644 --- a/spec/views/shared/milestones/_issuable.html.haml_spec.rb +++ b/spec/views/shared/milestones/_issuable.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'shared/milestones/_issuable.html.haml' do diff --git a/spec/views/shared/milestones/_issuables.html.haml_spec.rb b/spec/views/shared/milestones/_issuables.html.haml_spec.rb index 24b55338db3..f77c14a687b 100644 --- a/spec/views/shared/milestones/_issuables.html.haml_spec.rb +++ b/spec/views/shared/milestones/_issuables.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'shared/milestones/_issuables.html.haml' do diff --git a/spec/views/shared/milestones/_top.html.haml_spec.rb b/spec/views/shared/milestones/_top.html.haml_spec.rb index f2ee8be5857..944dfc8a27b 100644 --- a/spec/views/shared/milestones/_top.html.haml_spec.rb +++ b/spec/views/shared/milestones/_top.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'shared/milestones/_top.html.haml' do diff --git a/spec/views/shared/notes/_form.html.haml_spec.rb b/spec/views/shared/notes/_form.html.haml_spec.rb index 0189f926a5f..d354c2f0100 100644 --- a/spec/views/shared/notes/_form.html.haml_spec.rb +++ b/spec/views/shared/notes/_form.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'shared/notes/_form' do diff --git a/spec/views/shared/projects/_project.html.haml_spec.rb b/spec/views/shared/projects/_project.html.haml_spec.rb index dc223861037..b123be42074 100644 --- a/spec/views/shared/projects/_project.html.haml_spec.rb +++ b/spec/views/shared/projects/_project.html.haml_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'shared/projects/_project.html.haml' do |