Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 11:27:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 11:27:35 +0300
commit7e9c479f7de77702622631cff2628a9c8dcbc627 (patch)
treec8f718a08e110ad7e1894510980d2155a6549197 /spec/views
parente852b0ae16db4052c1c567d9efa4facc81146e88 (diff)
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb16
-rw-r--r--spec/views/profiles/preferences/show.html.haml_spec.rb57
-rw-r--r--spec/views/projects/ci/lints/show.html.haml_spec.rb127
-rw-r--r--spec/views/projects/merge_requests/show.html.haml_spec.rb2
-rw-r--r--spec/views/projects/settings/operations/show.html.haml_spec.rb2
-rw-r--r--spec/views/projects/tags/index.html.haml_spec.rb25
-rw-r--r--spec/views/registrations/welcome/show.html.haml_spec.rb (renamed from spec/views/registrations/welcome.html.haml_spec.rb)2
-rw-r--r--spec/views/search/_filter.html.haml_spec.rb2
-rw-r--r--spec/views/search/_results.html.haml_spec.rb36
9 files changed, 62 insertions, 207 deletions
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 3fb9fb54b01..c5b56b15431 100644
--- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
@@ -219,6 +219,22 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
+ describe 'pipeline editor link' do
+ it 'shows the pipeline editor link' do
+ render
+
+ expect(rendered).to have_link('Editor', href: project_ci_pipeline_editor_path(project))
+ end
+
+ it 'does not show the pipeline editor link' do
+ allow(view).to receive(:can_view_pipeline_editor?).and_return(false)
+
+ render
+
+ expect(rendered).not_to have_link('Editor', href: project_ci_pipeline_editor_path(project))
+ end
+ end
+
describe 'operations settings tab' do
describe 'archive projects' do
before do
diff --git a/spec/views/profiles/preferences/show.html.haml_spec.rb b/spec/views/profiles/preferences/show.html.haml_spec.rb
index aab50209953..2fe941b9f14 100644
--- a/spec/views/profiles/preferences/show.html.haml_spec.rb
+++ b/spec/views/profiles/preferences/show.html.haml_spec.rb
@@ -68,61 +68,4 @@ RSpec.describe 'profiles/preferences/show' do
expect(rendered).to have_css('#localization')
end
end
-
- context 'sourcegraph' do
- def have_sourcegraph_field(*args)
- have_field('user_sourcegraph_enabled', *args)
- end
-
- def have_integrations_section
- have_css('#integrations.profile-settings-sidebar', text: 'Integrations')
- end
-
- before do
- stub_feature_flags(sourcegraph: sourcegraph_feature)
- stub_application_setting(sourcegraph_enabled: sourcegraph_enabled)
- end
-
- context 'when not fully enabled' do
- where(:feature, :admin_enabled) do
- false | false
- false | true
- true | false
- end
-
- with_them do
- let(:sourcegraph_feature) { feature }
- let(:sourcegraph_enabled) { admin_enabled }
-
- before do
- render
- end
-
- it 'does not display sourcegraph field' do
- expect(rendered).not_to have_sourcegraph_field
- end
-
- it 'does not display Integration Settings' do
- expect(rendered).not_to have_integrations_section
- end
- end
- end
-
- context 'when fully enabled' do
- let(:sourcegraph_feature) { true }
- let(:sourcegraph_enabled) { true }
-
- before do
- render
- end
-
- it 'displays the sourcegraph field' do
- expect(rendered).to have_sourcegraph_field
- end
-
- it 'displays the integrations section' do
- expect(rendered).to have_integrations_section
- end
- end
- end
end
diff --git a/spec/views/projects/ci/lints/show.html.haml_spec.rb b/spec/views/projects/ci/lints/show.html.haml_spec.rb
deleted file mode 100644
index f59ad3f5f84..00000000000
--- a/spec/views/projects/ci/lints/show.html.haml_spec.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'projects/ci/lints/show' do
- include Devise::Test::ControllerHelpers
- let_it_be(:user) { create(:user) }
- let_it_be(:project) { create(:project, :repository) }
- let(:lint) { Gitlab::Ci::Lint.new(project: project, current_user: user) }
- let(:result) { lint.validate(YAML.dump(content)) }
-
- describe 'XSS protection' do
- before do
- assign(:project, project)
- assign(:result, result)
- stub_feature_flags(ci_lint_vue: false)
- end
-
- context 'when builds attrbiutes contain HTML nodes' do
- let(:content) do
- {
- rspec: {
- script: '<h1>rspec</h1>',
- stage: 'test'
- }
- }
- end
-
- it 'does not render HTML elements' do
- render
-
- expect(rendered).not_to have_css('h1', text: 'rspec')
- end
- end
-
- context 'when builds attributes do not contain HTML nodes' do
- let(:content) do
- {
- rspec: {
- script: 'rspec',
- stage: 'test'
- }
- }
- end
-
- it 'shows configuration in the table' do
- render
-
- expect(rendered).to have_css('td pre', text: 'rspec')
- end
- end
- end
-
- context 'when the content is valid' do
- let(:content) do
- {
- build_template: {
- script: './build.sh',
- tags: ['dotnet'],
- only: ['test@dude/repo'],
- except: ['deploy'],
- environment: 'testing'
- }
- }
- end
-
- before do
- assign(:project, project)
- assign(:result, result)
- stub_feature_flags(ci_lint_vue: false)
- end
-
- it 'shows the correct values' do
- render
-
- expect(rendered).to have_content('Status: syntax is correct')
- expect(rendered).to have_content('Tag list: dotnet')
- expect(rendered).to have_content('Only policy: refs, test@dude/repo')
- expect(rendered).to have_content('Except policy: refs, deploy')
- expect(rendered).to have_content('Environment: testing')
- expect(rendered).to have_content('When: on_success')
- end
-
- context 'when content has warnings' do
- before do
- allow(result).to receive(:warnings).and_return(['Warning 1', 'Warning 2'])
- end
-
- it 'shows warning messages' do
- render
-
- expect(rendered).to have_content('2 warning(s) found:')
- expect(rendered).to have_content('Warning 1')
- expect(rendered).to have_content('Warning 2')
- end
- end
- end
-
- context 'when the content is invalid' do
- let(:content) { double(:content) }
-
- before do
- allow(result).to receive(:warnings).and_return(['Warning 1', 'Warning 2'])
- allow(result).to receive(:errors).and_return(['Undefined error'])
-
- assign(:project, project)
- assign(:result, result)
- stub_feature_flags(ci_lint_vue: false)
- end
-
- it 'shows error message' do
- render
-
- expect(rendered).to have_content('Status: syntax is incorrect')
- expect(rendered).to have_content('Undefined error')
- expect(rendered).not_to have_content('Tag list:')
- end
-
- it 'shows warning messages' do
- render
-
- expect(rendered).to have_content('2 warning(s) found:')
- expect(rendered).to have_content('Warning 1')
- expect(rendered).to have_content('Warning 2')
- end
- end
-end
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 1acc07dabb6..9b4f2774c5b 100644
--- a/spec/views/projects/merge_requests/show.html.haml_spec.rb
+++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe 'projects/merge_requests/show.html.haml' do
render
- expect(rendered).not_to have_css('.cannot-be-merged')
+ expect(rendered).not_to have_css('.merge-icon')
end
end
end
diff --git a/spec/views/projects/settings/operations/show.html.haml_spec.rb b/spec/views/projects/settings/operations/show.html.haml_spec.rb
index 24ab64b20f5..facb4e2016d 100644
--- a/spec/views/projects/settings/operations/show.html.haml_spec.rb
+++ b/spec/views/projects/settings/operations/show.html.haml_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe 'projects/settings/operations/show' do
end
before_all do
- project.add_reporter(user)
+ project.add_maintainer(user)
end
before do
diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb
index 4d501b82238..8cc86b75873 100644
--- a/spec/views/projects/tags/index.html.haml_spec.rb
+++ b/spec/views/projects/tags/index.html.haml_spec.rb
@@ -57,4 +57,29 @@ RSpec.describe 'projects/tags/index.html.haml' do
expect(rendered).not_to have_link(href: latest_succeeded_project_artifacts_path(project, "#{pipeline.ref}/download", job: 'test'))
end
end
+
+ context 'build stats' do
+ let(:tag) { 'v1.0.0' }
+ let(:page) { Capybara::Node::Simple.new(rendered) }
+
+ it 'shows build status or placeholder when pipelines present' do
+ create(:ci_pipeline,
+ project: project,
+ ref: tag,
+ sha: project.commit(tag).sha,
+ status: :success)
+ assign(:tag_pipeline_statuses, Ci::CommitStatusesFinder.new(project, project.repository, project.namespace.owner, tags).execute)
+
+ render
+
+ expect(page.find('.tags .content-list li', text: tag)).to have_css 'a.ci-status-icon-success'
+ expect(page.all('.tags .content-list li')).to all(have_css('svg.s24'))
+ end
+
+ it 'shows no build status or placeholder when no pipelines present' do
+ render
+
+ expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24'
+ end
+ end
end
diff --git a/spec/views/registrations/welcome.html.haml_spec.rb b/spec/views/registrations/welcome/show.html.haml_spec.rb
index 56a7784a134..bede52bed4b 100644
--- a/spec/views/registrations/welcome.html.haml_spec.rb
+++ b/spec/views/registrations/welcome/show.html.haml_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'registrations/welcome' do
+RSpec.describe 'registrations/welcome/show' do
using RSpec::Parameterized::TableSyntax
let_it_be(:user) { User.new }
diff --git a/spec/views/search/_filter.html.haml_spec.rb b/spec/views/search/_filter.html.haml_spec.rb
index eb32528e3c7..9a5ff2e4518 100644
--- a/spec/views/search/_filter.html.haml_spec.rb
+++ b/spec/views/search/_filter.html.haml_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe 'search/_filter' do
render
expect(rendered).to have_selector('label[for="dashboard_search_group"]')
- expect(rendered).to have_selector('button#dashboard_search_group')
+ expect(rendered).to have_selector('input#js-search-group-dropdown')
expect(rendered).to have_selector('label[for="dashboard_search_project"]')
expect(rendered).to have_selector('button#dashboard_search_project')
diff --git a/spec/views/search/_results.html.haml_spec.rb b/spec/views/search/_results.html.haml_spec.rb
index 033b2304e33..6299fd0cf36 100644
--- a/spec/views/search/_results.html.haml_spec.rb
+++ b/spec/views/search/_results.html.haml_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe 'search/_results' do
let_it_be(:wiki_blob) { create(:wiki_page, project: project, content: '*') }
let_it_be(:user) { create(:admin) }
- %w[issues blobs notes wiki_blobs merge_requests milestones].each do |search_scope|
+ %w[issues merge_requests].each do |search_scope|
context "when scope is #{search_scope}" do
let(:scope) { search_scope }
let(:search_objects) { Gitlab::ProjectSearchResults.new(user, '*', project: project).objects(scope) }
@@ -55,32 +55,30 @@ RSpec.describe 'search/_results' do
expect(rendered).to have_selector('[data-track-property=search_result]')
end
- it 'renders the state filter drop down' do
+ it 'does render the sidebar' do
render
- expect(rendered).to have_selector('#js-search-filter-by-state')
+ expect(rendered).to have_selector('#js-search-sidebar')
end
+ end
+ end
- context 'Feature search_filter_by_confidential' do
- context 'when disabled' do
- before do
- stub_feature_flags(search_filter_by_confidential: false)
- end
+ %w[blobs notes wiki_blobs milestones].each do |search_scope|
+ context "when scope is #{search_scope}" do
+ let(:scope) { search_scope }
+ let(:search_objects) { Gitlab::ProjectSearchResults.new(user, '*', project: project).objects(scope) }
- it 'does not render the confidential drop down' do
- render
+ it 'renders the click text event tracking attributes' do
+ render
- expect(rendered).not_to have_selector('#js-search-filter-by-confidential')
- end
- end
+ expect(rendered).to have_selector('[data-track-event=click_text]')
+ expect(rendered).to have_selector('[data-track-property=search_result]')
+ end
- context 'when enabled' do
- it 'renders the confidential drop down' do
- render
+ it 'does not render the sidebar' do
+ render
- expect(rendered).to have_selector('#js-search-filter-by-confidential')
- end
- end
+ expect(rendered).not_to have_selector('#js-search-sidebar')
end
end
end