Commit 22e9af3c authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent c8e28a0b
......@@ -301,12 +301,6 @@ RSpec/AnyInstanceOf:
Enabled: false
# Cops for upgrade to gitlab-styles 3.1.0
RSpec/ReceiveCounts:
Enabled: false
RSpec/ContextMethod:
Enabled: false
RSpec/ImplicitSubject:
Enabled: false
......@@ -343,6 +337,7 @@ RSpec/MissingExampleGroupArgument:
RSpec/UnspecifiedException:
Enabled: false
# Work in progress. See https://gitlab.com/gitlab-org/gitlab/issues/196163
RSpec/HaveGitlabHttpStatus:
Enabled: true
Include:
......@@ -350,6 +345,8 @@ RSpec/HaveGitlabHttpStatus:
- 'ee/spec/support/shared_examples/**/*'
- 'spec/features/**/*'
- 'ee/spec/features/**/*'
- 'spec/controllers/*.rb'
- 'ee/spec/controllers/*.rb'
Style/MultilineWhenThen:
Enabled: false
......
......@@ -782,3 +782,129 @@ Style/UnneededSort:
Exclude:
- 'app/models/concerns/resolvable_discussion.rb'
- 'lib/gitlab/highlight.rb'
RSpec/ReceiveCounts:
Exclude:
- 'ee/spec/models/broadcast_message_spec.rb'
- 'ee/spec/services/geo/project_housekeeping_service_spec.rb'
- 'ee/spec/services/geo/repository_sync_service_spec.rb'
- 'spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb'
- 'spec/lib/gitlab/ci/trace/section_parser_spec.rb'
- 'spec/lib/gitlab/cleanup/project_uploads_spec.rb'
- 'spec/lib/gitlab/danger/teammate_spec.rb'
- 'spec/lib/gitlab/git_access_spec.rb'
- 'spec/lib/gitlab/gpg_spec.rb'
- 'spec/lib/gitlab/legacy_github_import/importer_spec.rb'
- 'spec/lib/gitlab/sanitizers/exif_spec.rb'
- 'spec/models/concerns/avatarable_spec.rb'
- 'spec/models/concerns/triggerable_hooks_spec.rb'
- 'spec/requests/api/graphql_spec.rb'
- 'spec/services/ci/ensure_stage_service_spec.rb'
- 'spec/services/clusters/cleanup/app_service_spec.rb'
- 'spec/services/notification_service_spec.rb'
- 'spec/services/projects/housekeeping_service_spec.rb'
- 'spec/tasks/gitlab/cleanup_rake_spec.rb'
- 'spec/uploaders/gitlab_uploader_spec.rb'
- 'spec/workers/create_gpg_signature_worker_spec.rb'
RSpec/ContextMethod:
Exclude:
- 'ee/spec/controllers/ee/projects/autocomplete_sources_controller_spec.rb'
- 'ee/spec/controllers/groups/autocomplete_sources_controller_spec.rb'
- 'ee/spec/finders/geo/file_registry_finder_spec.rb'
- 'ee/spec/helpers/feature_flags_helper_spec.rb'
- 'ee/spec/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules_spec.rb'
- 'ee/spec/lib/ee/gitlab/ci/config/entry/trigger_spec.rb'
- 'ee/spec/lib/elastic/latest/snippet_instance_proxy_spec.rb'
- 'ee/spec/lib/gitlab/contribution_analytics/data_collector_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/file_transfer_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/job_artifact_downloader_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/job_artifact_retriever_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/job_artifact_transfer_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/lfs_downloader_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/lfs_retriever_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/lfs_transfer_spec.rb'
- 'ee/spec/lib/gitlab/geo_spec.rb'
- 'ee/spec/models/approval_state_spec.rb'
- 'ee/spec/models/approval_wrapped_any_approver_rule_spec.rb'
- 'ee/spec/models/concerns/approval_rule_like_spec.rb'
- 'ee/spec/models/concerns/elastic/issue_spec.rb'
- 'ee/spec/models/concerns/elastic/note_spec.rb'
- 'ee/spec/models/concerns/elastic/project_spec.rb'
- 'ee/spec/models/concerns/epic_tree_sorting_spec.rb'
- 'ee/spec/models/concerns/has_timelogs_report_spec.rb'
- 'ee/spec/models/ee/clusters/applications/prometheus_spec.rb'
- 'ee/spec/models/ee/clusters/platforms/kubernetes_spec.rb'
- 'ee/spec/models/user_spec.rb'
- 'ee/spec/presenters/ci/pipeline_presenter_spec.rb'
- 'ee/spec/requests/api/epics_spec.rb'
- 'ee/spec/services/boards/update_service_spec.rb'
- 'ee/spec/services/ee/boards/issues/list_service_spec.rb'
- 'ee/spec/services/ee/merge_requests/refresh_service_spec.rb'
- 'ee/spec/services/groups/update_service_spec.rb'
- 'ee/spec/services/projects/create_from_template_service_spec.rb'
- 'ee/spec/services/projects/update_service_spec.rb'
- 'ee/spec/services/update_build_minutes_service_spec.rb'
- 'ee/spec/support/shared_examples/features/gold_trial_callout_shared_examples.rb'
- 'ee/spec/support/shared_examples/models/concerns/elastic/limited_indexing_shared_examples.rb'
- 'qa/spec/ee/scenario/test/integration/group_saml_spec.rb'
- 'qa/spec/resource/api_fabricator_spec.rb'
- 'qa/spec/scenario/test/integration/github_spec.rb'
- 'qa/spec/scenario/test/integration/instance_saml_spec.rb'
- 'qa/spec/scenario/test/integration/kubernetes_spec.rb'
- 'qa/spec/scenario/test/integration/ldap_spec.rb'
- 'qa/spec/scenario/test/integration/mattermost_spec.rb'
- 'qa/spec/scenario/test/integration/oauth_spec.rb'
- 'qa/spec/scenario/test/integration/object_storage_spec.rb'
- 'qa/spec/specs/runner_spec.rb'
- 'spec/controllers/application_controller_spec.rb'
- 'spec/controllers/projects/milestones_controller_spec.rb'
- 'spec/features/projects/blobs/blob_show_spec.rb'
- 'spec/finders/concerns/finder_with_cross_project_access_spec.rb'
- 'spec/helpers/diff_helper_spec.rb'
- 'spec/helpers/nav_helper_spec.rb'
- 'spec/helpers/sourcegraph_helper_spec.rb'
- 'spec/lib/container_registry/registry_spec.rb'
- 'spec/lib/container_registry/tag_spec.rb'
- 'spec/lib/gitlab/ci/trace/chunked_io_spec.rb'
- 'spec/lib/gitlab/content_security_policy/config_loader_spec.rb'
- 'spec/lib/gitlab/database/count_spec.rb'
- 'spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb'
- 'spec/lib/gitlab/git_ref_validator_spec.rb'
- 'spec/lib/gitlab/private_commit_email_spec.rb'
- 'spec/lib/gitlab/rugged_instrumentation_spec.rb'
- 'spec/lib/omni_auth/strategies/jwt_spec.rb'
- 'spec/lib/safe_zip/entry_spec.rb'
- 'spec/lib/safe_zip/extract_spec.rb'
- 'spec/models/badge_spec.rb'
- 'spec/models/badges/project_badge_spec.rb'
- 'spec/models/ci/artifact_blob_spec.rb'
- 'spec/models/ci/persistent_ref_spec.rb'
- 'spec/models/ci/runner_spec.rb'
- 'spec/models/concerns/routable_spec.rb'
- 'spec/models/deployment_spec.rb'
- 'spec/models/issue_spec.rb'
- 'spec/models/notification_recipient_spec.rb'
- 'spec/models/project_services/bamboo_service_spec.rb'
- 'spec/models/project_services/buildkite_service_spec.rb'
- 'spec/models/project_services/chat_message/issue_message_spec.rb'
- 'spec/models/project_services/drone_ci_service_spec.rb'
- 'spec/models/project_services/hipchat_service_spec.rb'
- 'spec/models/project_services/jira_service_spec.rb'
- 'spec/models/project_spec.rb'
- 'spec/models/remote_mirror_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/models/wiki_page_spec.rb'
- 'spec/requests/api/issues/get_group_issues_spec.rb'
- 'spec/requests/api/merge_requests_spec.rb'
- 'spec/serializers/diff_file_entity_spec.rb'
- 'spec/services/branches/delete_merged_service_spec.rb'
- 'spec/services/labels/available_labels_service_spec.rb'
- 'spec/services/projects/batch_open_issues_count_service_spec.rb'
- 'spec/services/projects/destroy_service_spec.rb'
- 'spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb'
- 'spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb'
- 'spec/services/projects/open_issues_count_service_spec.rb'
- 'spec/services/quick_actions/interpret_service_spec.rb'
- 'spec/support/shared_examples/services/boards/issues_list_service_shared_examples.rb'
- 'spec/uploaders/namespace_file_uploader_spec.rb'
\ No newline at end of file
......@@ -45,13 +45,13 @@ export default class DropdownOperator extends FilteredSearchDropdown {
tag: 'equal',
type: 'string',
title: '=',
help: __('Is'),
help: __('is'),
},
{
tag: 'not-equal',
type: 'string',
title: '!=',
help: __('Is not'),
help: __('is not'),
},
];
this.droplab.changeHookList(this.hookId, this.dropdown, [Filter], this.config);
......
......@@ -35,6 +35,7 @@ export default {
joinPaths(
gon.relative_url_root || '/',
file.projectId,
'-',
'raw',
sha,
escapeFileUrl(filePath),
......@@ -67,7 +68,7 @@ export default {
return Api.commitMultiple(projectId, payload);
},
getFiles(projectUrl, ref) {
const url = `${projectUrl}/files/${ref}`;
const url = `${projectUrl}/-/files/${ref}`;
return axios.get(url, { params: { format: 'json' } });
},
lastCommitPipelines({ getters }) {
......
......@@ -107,10 +107,10 @@ export default {
return acc.concat({
name,
path,
to: `/tree/${this.ref}${path}`,
to: `/-/tree/${this.ref}${path}`,
});
},
[{ name: this.projectShortPath, path: '/', to: `/tree/${this.ref}/` }],
[{ name: this.projectShortPath, path: '/', to: `/-/tree/${this.ref}/` }],
);
},
canCreateMrFromFork() {
......
......@@ -28,7 +28,7 @@ export default {
return splitArray.join('/');
},
parentRoute() {
return { path: `/tree/${this.commitRef}/${this.parentPath}` };
return { path: `/-/tree/${this.commitRef}/${this.parentPath}` };
},
},
methods: {
......
......@@ -90,7 +90,7 @@ export default {
},
computed: {
routerLinkTo() {
return this.isFolder ? { path: `/tree/${this.ref}/${this.path}` } : null;
return this.isFolder ? { path: `/-/tree/${this.ref}/${this.path}` } : null;
},
iconName() {
return `fa-${getIconName(this.type, this.path)}`;
......
......@@ -12,7 +12,7 @@ export default function createRouter(base, baseRef) {
base: joinPaths(gon.relative_url_root || '', base),
routes: [
{
path: `/tree/${baseRef}(/.*)?`,
path: `/-/tree/${baseRef}(/.*)?`,
name: 'treePath',
component: TreePage,
props: route => ({
......
......@@ -79,10 +79,10 @@ export default {
return this.projectPath.indexOf('/') === 0 ? '' : `${gon.relative_url_root}/`;
},
fullOldPath() {
return `${this.basePath}${this.projectPath}/raw/${this.oldSha}/${this.oldPath}`;
return `${this.basePath}${this.projectPath}/-/raw/${this.oldSha}/${this.oldPath}`;
},
fullNewPath() {
return `${this.basePath}${this.projectPath}/raw/${this.newSha}/${this.newPath}`;
return `${this.basePath}${this.projectPath}/-/raw/${this.newSha}/${this.newPath}`;
},
},
};
......
<script>
import { GlButton } from '@gitlab/ui';
import { PREV, NEXT } from '~/vue_shared/components/pagination/constants';
/**
* Pagination Component for graphql API
*/
export default {
name: 'GraphqlPaginationComponent',
components: {
GlButton,
},
labels: {
prev: PREV,
next: NEXT,
},
props: {
hasNextPage: {
required: true,
type: Boolean,
},
hasPreviousPage: {
required: true,
type: Boolean,
},
},
};
</script>
<template>
<div class="justify-content-center d-flex prepend-top-default">
<div class="btn-group">
<gl-button
class="js-prev-btn page-link"
:disabled="!hasPreviousPage"
@click="$emit('previousClicked')"
>{{ $options.labels.prev }}</gl-button
>
<gl-button
class="js-next-btn page-link"
:disabled="!hasNextPage"
@click="$emit('nextClicked')"
>{{ $options.labels.next }}</gl-button
>
</div>
</div>
</template>
......@@ -39,9 +39,9 @@ module SubmoduleHelper
elsif relative_self_url?(url)
relative_self_links(url, submodule_item_id, repository.project)
elsif github_dot_com_url?(url)
standard_links('github.com', namespace, project, submodule_item_id)
github_com_tree_links(namespace, project, submodule_item_id)
elsif gitlab_dot_com_url?(url)
standard_links('gitlab.com', namespace, project, submodule_item_id)
gitlab_com_tree_links(namespace, project, submodule_item_id)
else
[sanitize_submodule_url(url), nil]
end
......@@ -73,8 +73,13 @@ module SubmoduleHelper
url.start_with?('../', './')
end
def standard_links(host, namespace, project, commit)
base = ['https://', host, '/', namespace, '/', project].join('')
def gitlab_com_tree_links(namespace, project, commit)
base = ['https://gitlab.com/', namespace, '/', project].join('')
[base, [base, '/-/tree/', commit].join('')]
end
def github_com_tree_links(namespace, project, commit)
base = ['https://github.com/', namespace, '/', project].join('')
[base, [base, '/tree/', commit].join('')]
end
......
......@@ -38,13 +38,13 @@ module TreeHelper
# many paths, as with a repository tree that has thousands of items.
def fast_project_blob_path(project, blob_path)
ActionDispatch::Journey::Router::Utils.escape_path(
File.join(relative_url_root, project.path_with_namespace, 'blob', blob_path)
File.join(relative_url_root, project.path_with_namespace, '-', 'blob', blob_path)
)
end
def fast_project_tree_path(project, tree_path)
ActionDispatch::Journey::Router::Utils.escape_path(
File.join(relative_url_root, project.path_with_namespace, 'tree', tree_path)
File.join(relative_url_root, project.path_with_namespace, '-', 'tree', tree_path)
)
end
......
......@@ -96,8 +96,7 @@ class Key < ApplicationRecord
def remove_from_shell
GitlabShellWorker.perform_async(
:remove_key,
shell_id,
key
shell_id
)
end
......
......@@ -447,6 +447,8 @@ class Repository
def after_import
expire_content_cache
return unless repo_type.project?
# This call is stubbed in tests due to being an expensive operation
# It can be reenabled for specific tests via:
#
......
---
title: Switch dropdown operators to lowercase
merge_request:
author:
type: other
---
title: Support the bypass 2FA function with ADFS SAML
merge_request: 23615
author:
type: fixed
---
title: Require other stages than .pre and .post
merge_request: 23629
author:
type: fixed
---
title: Move repository routes under - scope
merge_request: 20455
author:
type: deprecated
---
title: Call DetectRepositoryLanguagesWorker only for project repositories
merge_request: 23696
author:
type: fixed
......@@ -286,6 +286,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# The wiki and repository routing contains wildcard characters so
# its preferable to keep it below all other project routes
draw :repository_scoped
draw :repository
draw :wiki
end
# End of the /-/ scope.
......@@ -476,14 +477,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post :web_ide_clientside_preview
end
# The repository routing contains wildcard characters so
# its preferable to keep it below all other project routes
draw :repository
# To ensure an old unscoped routing is used for the UI we need to
# add prefix 'as' to the scope routing and place it below original routing.
# Deprecated unscoped routing.
# Issue https://gitlab.com/gitlab-org/gitlab/issues/118849
scope '-', as: 'scoped' do
scope as: 'deprecated' do
draw :repository
end
......
......@@ -91,7 +91,7 @@ Below we assume that you have administrative access as the `postgres`
user. First open a `psql` session as the `postgres` user:
```shell
psql -h POSTGRESQL_SERVER -U postgres -d template1
/opt/gitlab/embedded/bin/psql -h POSTGRESQL_SERVER -U postgres -d template1
```
Once you are connected, run the following command. Replace
......@@ -100,21 +100,21 @@ generated for the `praefect` SQL user:
```sql
CREATE ROLE praefect WITH LOGIN CREATEDB PASSWORD 'PRAEFECT_SQL_PASSWORD';
\q # exit psql
\q
```
Now connect as the `praefect` user to create the database. This has
the side effect of verifying that you have access:
```shell
psql -h POSTGRESQL_SERVER -U praefect -d template1
/opt/gitlab/embedded/bin/psql -h POSTGRESQL_SERVER -U praefect -d template1
```
Once you have connected as the `praefect` user, run:
```sql
CREATE DATABASE praefect_production WITH ENCODING=UTF8;
\q # quit psql
\q
```
#### Praefect
......@@ -260,9 +260,17 @@ git_data_dirs({
For more information on Gitaly server configuration, see our [Gitaly documentation](index.md#3-gitaly-server-configuration).
When finished editing the configuration file for each Gitaly server, run the
reconfigure command to put changes into effect:
```shell
sudo gitlab-ctl reconfigure
```
When all Gitaly servers are configured, you can run the Praefect connection
checker to verify Praefect can connect to all Gitaly servers in the Praefect
config:
config. This can be done by running the following command on the Praefect
server:
```shell
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dial-nodes
......
......@@ -396,3 +396,93 @@ export default () => {};
```
[vuex-docs]: https://vuex.vuejs.org
### Two way data binding
When storing form data in Vuex, it is sometimes necessary to update the value stored. The store should never be mutated directly, and an action should be used instead.
In order to still use `v-model` in our code, we need to create computed properties in this form:
```javascript
export default {
computed: {
someValue: {
get() {
return this.$store.state.someValue;
},
set(value) {
this.$store.dispatch("setSomeValue", value);
}
}
}
};
```
An alternative is to use `mapState` and `mapActions`:
```javascript
export default {
computed: {
...mapState(['someValue']),
localSomeValue: {
get() {
return this.someValue;
},
set(value) {
this.setSomeValue(value)
}
}
},
methods: {
...mapActions(['setSomeValue'])
}
};
```
Adding a few of these properties becomes cumbersome, and makes the code more repetitive with more tests to write. To simplify this there is a helper in `~/vuex_shared/bindings.js`
The helper can be used like so:
```javascript
// this store is non-functional and only used to give context to the example
export default {
state: {
baz: '',
bar: '',
foo: ''
},
actions: {
updateBar() {...}
updateAll() {...}
},
getters: {
getFoo() {...}
}
}
```
```javascript
import { mapComputed } from '~/vuex_shared/bindings'
export default {
computed: {
/**
* @param {(string[]|Object[])} list - list of string matching state keys or list objects
* @param {string} list[].key - the key matching the key present in the vuex state
* @param {string} list[].getter - the name of the getter, leave it empty to not use a getter
* @param {string} list[].updateFn - the name of the action, leave it empty to use the default action
* @param {string} defaultUpdateFn - the default function to dispatch
* @param {string} root - optional key of the state where to search fo they keys described in list
* @returns {Object} a dictionary with all the computed properties generated
*/
...mapComputed(
[
'baz',
{ key: 'bar', updateFn: 'updateBar' }
{ key: 'foo', getter: 'getFoo' },
],
'updateAll',
),
}
}
```
`mapComputed` will then generate the appropriate computed properties that get the data from the store and dispatch the correct action when updated.
......@@ -532,20 +532,24 @@ This is especially useful whenever it's showing 500 internal server error.
### Shared contexts
All shared contexts should be placed under `spec/support/shared_contexts/`.
Shared contexts can be placed in subfolder if they apply to a certain type of
specs only (e.g. features, requests etc.) but shouldn't be if they apply to
multiple type of specs.
Shared contexts only used in one spec file can be declared inline.
Any shared contexts used by more than one spec file:
- Should be placed under `spec/support/shared_contexts/`.
- Can be placed in subfolder if they apply to a certain type of specs only
(e.g. features, requests etc.) but shouldn't be if they apply to multiple type of specs.
Each file should include only one context and have a descriptive name, e.g.
`spec/support/shared_contexts/controllers/githubish_import_controller_shared_context.rb`.
### Shared examples
All shared examples should be placed under `spec/support/shared_examples/`.
Shared examples can be placed in subfolder if they apply to a certain type of
specs only (e.g. features, requests etc.) but shouldn't be if they apply to
multiple type of specs.
Shared examples only used in one spec file can be declared inline.
Any shared examples used by more than one spec file:
- Should be placed under `spec/support/shared_examples/`.
- Can be placed in subfolder if they apply to a certain type of specs only
(e.g. features, requests etc.) but shouldn't be if they apply to multiple type of specs.
Each file should include only one context and have a descriptive name, e.g.
`spec/support/shared_examples/controllers/githubish_import_controller_shared_example.rb`.
......
......@@ -40,7 +40,7 @@ The various scanning tools and the vulnerabilities database are updated regularl
|:-------------------------------------------------------------|-------------------------------------------|
| [Container Scanning](container_scanning/index.md) | Uses `clair` underneath and the latest `clair-db` version is used for each job run by running the [`latest` docker image tag](https://gitlab.com/gitlab-org/gitlab/blob/438a0a56dc0882f22bdd82e700554525f552d91b/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml#L37). The `clair-db` database [is updated daily according to the author](https://github.com/arminc/clair-local-scan#clair-server-or-local). |
| [Dependency Scanning](dependency_scanning/index.md) | Relies on `bundler-audit` (for Rubygems), `retire.js` (for NPM packages) and `gemnasium` (GitLab's own tool for all libraries). `bundler-audit` and `retire.js` both fetch their vulnerabilities data from GitHub repositories, so vulnerabilities added to `ruby-advisory-db` and `retire.js` are immediately available. The tools themselves are updated once per month if there's a new version. The [Gemnasium DB](https://gitlab.com/gitlab-org/security-products/gemnasium-db) is updated at least once a week. |
| [Dynamic Application Security Testing (DAST)](dast/index.md) | Updated weekly on Sundays. The underlying tool, `zaproxy`, downloads fresh rules at startup. |
| [Dynamic Application Security Testing (DAST)](dast/index.md) | The scanning engine is updated on a periodic basis. See the [version of the underlying tool `zaproxy`](https://gitlab.com/gitlab-org/security-products/dast/blob/master/Dockerfile#L1). The scanning rules are downloaded at the runtime of the scan. |
| [Static Application Security Testing (SAST)](sast/index.md) | Relies exclusively on [the tools GitLab is wrapping](sast/index.md#supported-languages-and-frameworks). The underlying analyzers are updated at least once per month if a relevant update is available. The vulnerabilities database is updated by the upstream tools. |
You don't have to update GitLab to benefit from the latest vulnerabilities definitions,
......
This diff is collapsed.
......@@ -101,11 +101,18 @@ module Banzai
def rebuild_relative_uri(uri)
file_path = nested_file_path_if_exists(uri)
resource_type = uri_type(file_path)
# Repository routes are under /-/ scope now.
# Since we craft a path without using route helpers we must
# ensure - is added here.
prefix = '-' if %w(tree blob raw commits).include?(resource_type.to_s)
uri.path = [
relative_url_root,
project.full_path,
uri_type(file_path),
prefix,
resource_type,
Addressable::URI.escape(ref).gsub('#', '%23'),
Addressable::URI.escape(file_path)
].compact.join('/').squeeze('/').chomp('/')
......
......@@ -28,7 +28,7 @@ module Gitlab
end
def extract_authn_context(document)
REXML::XPath.first(document, "//*[name()='saml:AuthnStatement' or name()='saml2:AuthnStatement']/*[name()='saml:AuthnContext' or name()='saml2:AuthnContext']/*[name()='saml:AuthnContextClassRef' or name()='saml2:AuthnContextClassRef']/text()").to_s
REXML::XPath.first(document, "//*[name()='saml:AuthnStatement' or name()='saml2:AuthnStatement' or name()='AuthnStatement']/*[name()='saml:AuthnContext' or name()='saml2:AuthnContext' or name()='AuthnContext']/*[name()='saml:AuthnContextClassRef' or name()='saml2:AuthnContextClassRef' or name()='AuthnContextClassRef']/text()").to_s
end
end
end
......
......@@ -17,7 +17,7 @@ module Gitlab
#
pipeline.stages = @command.stage_seeds.map(&:to_resource)
if pipeline.stages.none?
if stage_names.empty?
return error('No stages / jobs for this pipeline.')
end
......@@ -31,6 +31,15 @@ module Gitlab
def break?
pipeline.errors.any?
end
private
def stage_names
# We filter out `.pre/.post` stages, as they alone are not considered
# a complete pipeline:
# https://gitlab.com/gitlab-org/gitlab/issues/198518
pipeline.stages.map(&:name) - ::Gitlab::Ci::Config::EdgeStagesInjector::EDGES
end
end
end
end
......
......@@ -12,10 +12,12 @@ module Gitlab
def link_dependencies
link_json('ImportPath') do |path|
case path
when %r{\A(?<repo>github\.com/#{REPO_REGEX})/(?<path>.+)\z}
"https://#{$~[:repo]}/tree/master/#{$~[:path]}"
when %r{\A(?<repo>gitlab\.com/#{NESTED_REPO_REGEX})\.git/(?<path>.+)\z},
%r{\A(?<repo>git(lab|hub)\.com/#{REPO_REGEX})/(?<path>.+)\z}
%r{\A(?<repo>gitlab\.com/#{REPO_REGEX})/(?<path>.+)\z}
"https://#{$~[:repo]}/tree/master/#{$~[:path]}"
"https://#{$~[:repo]}/-/tree/master/#{$~[:path]}"
when /\Agolang\.org/
"https://godoc.org/#{path}"
else
......
......@@ -60,7 +60,7 @@ module Gitlab
end
meta_import_tag = tag :meta, name: 'go-import', content: "#{import_prefix} git #{repository_url}"
meta_source_tag = tag :meta, name: 'go-source', content: "#{import_prefix} #{project_url} #{project_url}/tree/#{branch}{/dir} #{project_url}/blob/#{branch}{/dir}/{file}#L{line}"
meta_source_tag = tag :meta, name: 'go-source', content: "#{import_prefix} #{project_url} #{project_url}/-/tree/#{branch}{/dir} #{project_url}/-/blob/#{branch}{/dir}/{file}#L{line}"
head_tag = content_tag :head, meta_import_tag + meta_source_tag
html_tag = content_tag :html, head_tag + body_tag
[html_tag, 200]
......
This diff is collapsed.
......@@ -10407,15 +10407,9 @@ msgstr ""
msgid "Invocations"
msgstr ""
msgid "Is"
msgstr ""
msgid "Is blocked by"
msgstr ""
msgid "Is not"
msgstr ""
msgid "Is using license seat:"
msgstr ""
......@@ -22464,6 +22458,9 @@ msgstr[1] ""
msgid "invalid milestone state `%{state}`"
msgstr ""
msgid "is"
msgstr ""
msgid "is an invalid IP address range"
msgstr ""
......@@ -22479,6 +22476,9 @@ msgstr ""
msgid "is invalid because there is upstream lock"
msgstr ""
msgid "is not"
msgstr ""
msgid "is not a descendant of the Group owning the template"
msgstr ""
......
......@@ -28,7 +28,7 @@ describe AcmeChallengesController do
let(:token) { acme_order.challenge_token }
it 'renders not found' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -37,7 +37,7 @@ describe AcmeChallengesController do
let(:token) { 'wrongtoken' }
it 'renders not found' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -156,7 +156,7 @@ describe ApplicationController do
it 'returns 200 response' do
get :index, format: requested_format
expect(response).to have_gitlab_http_status 200
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -164,7 +164,7 @@ describe ApplicationController do
it 'returns 404 response' do
get :index
expect(response).to have_gitlab_http_status 404
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -181,7 +181,7 @@ describe ApplicationController do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
it 'redirects to login page if not authenticated' do
......@@ -202,7 +202,7 @@ describe ApplicationController do
get :index, format: 'unknown'
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
......@@ -489,7 +489,7 @@ describe ApplicationController do
it 'redirects if the user did not accept the terms' do
get :index
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
it 'does not redirect when the user accepted terms' do
......@@ -497,7 +497,7 @@ describe ApplicationController do
get :index
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -581,21 +581,21 @@ describe ApplicationController do
it 'renders a 404 without a message' do
get :index
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(response).to render_template('errors/not_found')
end
it 'renders a 403 when a message is passed to access denied' do
get :index, params: { message: 'None shall pass' }
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
expect(response).to render_template('errors/access_denied')
end
it 'renders a status passed to access denied' do
get :index, params: { status: 401 }
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
......
......@@ -32,7 +32,7 @@ describe AutocompleteController do
get(:users, params: { project_id: 'unknown' })
end
it { expect(response).to have_gitlab_http_status(404) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
end
......@@ -61,7 +61,7 @@ describe AutocompleteController do
get(:users, params: { group_id: 'unknown' })
end
it { expect(response).to have_gitlab_http_status(404) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
end
......@@ -140,7 +140,7 @@ describe AutocompleteController do
get(:users, params: { project_id: project.id })
end
it { expect(response).to have_gitlab_http_status(404) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
describe 'GET #users with unknown project' do
......@@ -148,7 +148,7 @@ describe AutocompleteController do
get(:users, params: { project_id: 'unknown' })
end
it { expect(response).to have_gitlab_http_status(404) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
describe 'GET #users with inaccessible group' do
......@@ -157,7 +157,7 @@ describe AutocompleteController do
get(:users, params: { group_id: user.namespace.id })
end
it { expect(response).to have_gitlab_http_status(404) }
it { expect(response).to have_gitlab_http_status(:not_found) }
end
describe 'GET #users with no project' do
......@@ -372,7 +372,7 @@ describe AutocompleteController do
it 'returns empty json' do
get :merge_request_target_branches, params: { project_id: project.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_empty
end
end
......@@ -383,7 +383,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { project_id: project.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_empty
end
end
......@@ -404,7 +404,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: params
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response).to eq({ 'error' => 'At least one of group_id or project_id must be specified' })
end
end
......@@ -416,7 +416,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { project_id: project.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to contain_exactly({ 'title' => 'feature' })
end
end
......@@ -433,7 +433,7 @@ describe AutocompleteController do
get :merge_request_target_branches, params: { group_id: group.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to contain_exactly({ 'title' => 'feature' })
end
end
......
......@@ -9,7 +9,7 @@ describe ChaosController do
get :leakmem
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'call synchronously with params' do
......@@ -17,7 +17,7 @@ describe ChaosController do
get :leakmem, params: { memory_mb: 1, duration_s: 2 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
......@@ -25,7 +25,7 @@ describe ChaosController do
get :leakmem, params: { async: 1 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -35,7 +35,7 @@ describe ChaosController do
get :cpu_spin
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls synchronously with params' do
......@@ -43,7 +43,7 @@ describe ChaosController do
get :cpu_spin, params: { duration_s: 3 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
......@@ -51,7 +51,7 @@ describe ChaosController do
get :cpu_spin, params: { async: 1 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -61,7 +61,7 @@ describe ChaosController do
get :db_spin
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls synchronously with params' do
......@@ -69,7 +69,7 @@ describe ChaosController do
get :db_spin, params: { duration_s: 4, interval_s: 5 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
......@@ -77,7 +77,7 @@ describe ChaosController do
get :db_spin, params: { async: 1 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -87,7 +87,7 @@ describe ChaosController do
get :sleep
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls synchronously with params' do
......@@ -95,7 +95,7 @@ describe ChaosController do
get :sleep, params: { duration_s: 5 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
......@@ -103,7 +103,7 @@ describe ChaosController do
get :sleep, params: { async: 1 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -113,7 +113,7 @@ describe ChaosController do
get :kill
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'calls asynchronously' do
......@@ -121,7 +121,7 @@ describe ChaosController do
get :kill, params: { async: 1 }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -72,7 +72,7 @@ describe MetricsDashboard do
it 'includes project_blob_path only for project dashboards' do
expect(system_dashboard['project_blob_path']).to be_nil
expect(project_dashboard['project_blob_path']).to eq("/#{project.namespace.path}/#{project.name}/blob/master/.gitlab/dashboards/test.yml")
expect(project_dashboard['project_blob_path']).to eq("/#{project.namespace.path}/#{project.name}/-/blob/master/.gitlab/dashboards/test.yml")
end
describe 'project permissions' do
......
......@@ -39,7 +39,7 @@ describe GraphqlController do
it 'returns 200 when user can access API' do
post :execute
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns access denied template when user cannot access API' do
......@@ -59,7 +59,7 @@ describe GraphqlController do
it 'returns 200' do
post :execute
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -136,7 +136,7 @@ describe GroupsController do
get :activity, params: { id: group.to_param }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['count']).to eq(3)
expect(assigns(:projects).limit_value).to be_nil
end
......@@ -151,7 +151,7 @@ describe GroupsController do
post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
context 'authorization' do
......@@ -162,7 +162,7 @@ describe GroupsController do
post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -367,7 +367,7 @@ describe GroupsController do
it 'updates the path successfully' do
post :update, params: { id: group.to_param, group: { path: 'new_path' } }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(controller).to set_flash[:notice]
end
......@@ -382,7 +382,7 @@ describe GroupsController do
it 'updates the project_creation_level successfully' do
post :update, params: { id: group.to_param, group: { project_creation_level: ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS } }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(group.reload.project_creation_level).to eq(::Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
end
......@@ -397,7 +397,7 @@ describe GroupsController do
post :update, params: { id: group.to_param, group: { name: 'new_name' } }
expect(controller).to set_flash[:notice]
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(group.reload.name).to eq('new_name')
end
......@@ -405,7 +405,7 @@ describe GroupsController do
post :update, params: { id: group.to_param, group: { path: 'new_path' } }
expect(assigns(:group).errors[:base].first).to match(/Docker images in their Container Registry/)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -468,7 +468,7 @@ describe GroupsController do
it 'does not redirect' do
get :issues, params: { id: group.to_param }
expect(response).not_to have_gitlab_http_status(301)
expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
......@@ -487,7 +487,7 @@ describe GroupsController do
it 'does not redirect' do
get :show, params: { id: group.to_param }
expect(response).not_to have_gitlab_http_status(301)
expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
......@@ -554,13 +554,13 @@ describe GroupsController do
it 'does not 404' do
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
expect(response).not_to have_gitlab_http_status(404)
expect(response).not_to have_gitlab_http_status(:not_found)
end
it 'does not redirect to the correct casing' do
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
expect(response).not_to have_gitlab_http_status(301)
expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
......@@ -570,7 +570,7 @@ describe GroupsController do
it 'returns not found' do
post :update, params: { id: redirect_route.path, group: { path: 'new_path' } }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -580,13 +580,13 @@ describe GroupsController do
it 'does not 404' do
delete :destroy, params: { id: group.to_param.upcase }
expect(response).not_to have_gitlab_http_status(404)
expect(response).not_to have_gitlab_http_status(:not_found)
end
it 'does not redirect to the correct casing' do
delete :destroy, params: { id: group.to_param.upcase }
expect(response).not_to have_gitlab_http_status(301)
expect(response).not_to have_gitlab_http_status(:moved_permanently)
end
end
......@@ -596,7 +596,7 @@ describe GroupsController do
it 'returns not found' do
delete :destroy, params: { id: redirect_route.path }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -693,7 +693,7 @@ describe GroupsController do
end
it 'is denied' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -755,13 +755,13 @@ describe GroupsController do
it 'is successful' do
get :show, params: { id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'does not allow other formats' do
get :show, params: { id: group.to_param }, format: :atom
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -769,7 +769,7 @@ describe GroupsController do
it 'is successful' do
get :edit, params: { id: group.to_param }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -777,7 +777,7 @@ describe GroupsController do
it 'is successful' do
get :new
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -786,7 +786,7 @@ describe GroupsController do
get :index
# Redirects to the dashboard
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -810,7 +810,7 @@ describe GroupsController do
it 'deletes the group' do
delete :destroy, params: { id: group.to_param }
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
......
......@@ -101,7 +101,7 @@ describe HealthCheckController, :request_store do
it 'supports failure plaintext response' do
get :index
expect(response).to have_gitlab_http_status(500)
expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'text/plain'
expect(response.body).to include('The server is on fire')
end
......@@ -109,7 +109,7 @@ describe HealthCheckController, :request_store do
it 'supports failure json response' do
get :index, format: :json
expect(response).to have_gitlab_http_status(500)
expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be false
expect(json_response['message']).to include('The server is on fire')
......@@ -118,7 +118,7 @@ describe HealthCheckController, :request_store do
it 'supports failure xml response' do
get :index, format: :xml
expect(response).to have_gitlab_http_status(500)
expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/xml'
expect(xml_response['healthy']).to be false
expect(xml_response['message']).to include('The server is on fire')
......@@ -127,7 +127,7 @@ describe HealthCheckController, :request_store do
it 'supports failure responses for specific checks' do
get :index, params: { checks: 'email' }, format: :json
expect(response).to have_gitlab_http_status(500)
expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be false
expect(json_response['message']).to include('Email is on fire')
......
......@@ -148,7 +148,7 @@ describe HelpController do
context 'for UI Development Kit' do
it 'renders found' do
get :ui
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -17,7 +17,7 @@ describe InvitesController do
get :accept, params: { id: token }
member.reload
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(member.user).to eq(user)
expect(flash[:notice]).to include 'You have been granted'
end
......@@ -28,7 +28,7 @@ describe InvitesController do
get :decline, params: { id: token }
expect {member.reload}.to raise_error ActiveRecord::RecordNotFound
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(flash[:notice]).to include 'You have declined the invitation to join'
end
end
......
......@@ -125,7 +125,7 @@ describe NotificationSettingsController do
notification_setting: { level: :participating }
}
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -195,7 +195,7 @@ describe NotificationSettingsController do
notification_setting: { level: :participating }
}
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -172,7 +172,7 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode:
it 'returns 403' do
post provider
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
......
......@@ -15,7 +15,7 @@ describe PasswordsController do
post :create
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(flash[:alert]).to eq _('Password authentication is unavailable.')
end
end
......
......@@ -87,7 +87,7 @@ describe ProfilesController, :request_store do
put :update, params: { user: { status: { message: 'Working hard!' } } }
expect(user.reload.status.message).to eq('Working hard!')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
......
......@@ -36,7 +36,7 @@ describe Projects::BlameController do
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/master")
.to redirect_to("/#{project.full_path}/-/tree/master")
end
end
......
......@@ -33,7 +33,7 @@ describe Projects::BlobController do
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/master")
.to redirect_to("/#{project.full_path}/-/tree/master")
end
end
......@@ -115,7 +115,7 @@ describe Projects::BlobController do
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/markdown/doc")
.to redirect_to("/#{project.full_path}/-/tree/markdown/doc")
end
end
end
......
......@@ -38,7 +38,7 @@ describe Projects::BranchesController do
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/merge_branch")
.to redirect_to("/#{project.full_path}/-/tree/merge_branch")
end
end
......@@ -48,7 +48,7 @@ describe Projects::BranchesController do
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/alert('merge');")
.to redirect_to("/#{project.full_path}/-/tree/alert('merge');")
end
end
......@@ -93,7 +93,7 @@ describe Projects::BranchesController do
}
expect(subject)
.to redirect_to("/#{project.full_path}/tree/1-feature-branch")
.to redirect_to("/#{project.full_path}/-/tree/1-feature-branch")
end
it 'posts a system note' do
......
......@@ -72,7 +72,7 @@ describe Projects::RawController do
env: :raw_blob_request_limit,
remote_ip: '0.0.0.0',
request_method: 'GET',
path: "/#{project.full_path}/raw/#{file_path}"
path: "/#{project.full_path}/-/raw/#{file_path}"
}
expect(Gitlab::AuthLogger).to receive(:error).with(attributes).once
......
......@@ -45,7 +45,7 @@ describe Projects::TreeController do
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/master")
.to redirect_to("/#{project.full_path}/-/tree/master")
end
end
......@@ -60,7 +60,7 @@ describe Projects::TreeController do
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/empty-branch")
.to redirect_to("/#{project.full_path}/-/tree/empty-branch")
end
end
......@@ -153,7 +153,7 @@ describe Projects::TreeController do
let(:id) { 'master/README.md' }
it 'redirects' do
redirect_url = "/#{project.full_path}/blob/master/README.md"
redirect_url = "/#{project.full_path}/-/blob/master/README.md"
expect(subject)
.to redirect_to(redirect_url)
end
......@@ -181,7 +181,7 @@ describe Projects::TreeController do
it 'redirects to the new directory' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/#{branch_name}/#{path}")
.to redirect_to("/#{project.full_path}/-/tree/#{branch_name}/#{path}")
expect(flash[:notice]).to eq('The directory has been successfully created.')
end
end
......@@ -192,7 +192,7 @@ describe Projects::TreeController do
it 'does not allow overwriting of existing files' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/master")
.to redirect_to("/#{project.full_path}/-/tree/master")
expect(flash[:alert]).to eq('A file with this name already exists')
end
end
......
......@@ -30,7 +30,7 @@ describe RegistrationsController do
it 'renders new template and sets the resource variable' do
expect(subject).to render_template(:new)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:resource)).to be_a(User)
end
end
......@@ -48,7 +48,7 @@ describe RegistrationsController do
it 'renders new template and sets the resource variable' do
subject
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(new_user_session_path(anchor: 'register-pane'))
end
end
......@@ -200,7 +200,7 @@ describe RegistrationsController do
.and_call_original
expect(Gitlab::AuthLogger).to receive(:error).with(auth_log_attributes).once
expect { post(:create, params: user_params, session: session_params) }.not_to change(User, :count)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to be_empty
end
end
......
......@@ -21,13 +21,13 @@ describe SearchController do
it 'blocks access without a project_id' do
get action, params: params
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'allows access with a project_id' do
get action, params: params.merge(project_id: create(:project, :public).id)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -42,13 +42,13 @@ describe SearchController do
it 'renders a 403 when no project is given' do
get action, params: params
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
it 'renders a 200 when a project was set' do
get action, params: params.merge(project_id: project.id)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -57,7 +57,7 @@ describe SearchController do
it 'still allows accessing the search page' do
get :show
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -195,7 +195,7 @@ describe SearchController do
get :count, params: { search: 'hello', scope: 'projects' }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq({ 'count' => '1' })
end
......
......@@ -22,7 +22,7 @@ describe SessionsController do
it 'redirects to :omniauth_authorize_path' do
get(:new)
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to('/saml')
end
end
......@@ -31,7 +31,7 @@ describe SessionsController do
it 'responds with 200' do
get(:new, params: { auto_sign_in: 'false' })
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......
......@@ -51,7 +51,7 @@ describe SnippetsController do
it 'responds with status 200' do
get :new
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context 'when user is not allowed to create a personal snippet' do
......@@ -60,7 +60,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :new
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -90,7 +90,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :show, params: { id: other_personal_snippet.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -99,13 +99,13 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'responds with status 404 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -131,13 +131,13 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'responds with status 404 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -162,14 +162,14 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'responds with status 200 when embeddable content is requested' do
get :show, params: { id: personal_snippet.to_param }, format: :js
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -178,7 +178,7 @@ describe SnippetsController do
get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -192,7 +192,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :show, params: { id: 'doesntexist' }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -234,7 +234,7 @@ describe SnippetsController do
create_snippet(visibility_level: Snippet::PUBLIC)
end.not_to change { Snippet.count }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -496,7 +496,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :raw, params: { id: other_personal_snippet.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -507,7 +507,7 @@ describe SnippetsController do
it 'responds with status 200' do
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
it 'has expected headers' do
......@@ -517,7 +517,7 @@ describe SnippetsController do
end
it "sets #{Gitlab::Workhorse::DETECT_HEADER} header" do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
end
end
......@@ -544,7 +544,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -569,7 +569,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
context 'CRLF line ending' do
......@@ -596,7 +596,7 @@ describe SnippetsController do
get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
......@@ -610,7 +610,7 @@ describe SnippetsController do
it 'responds with status 404' do
get :raw, params: { id: 'doesntexist' }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -712,7 +712,7 @@ describe SnippetsController do
it 'responds with status 404' do
delete :destroy, params: { id: snippet.to_param }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
This diff is collapsed.
......@@ -28,7 +28,7 @@ describe UsersController do
it 'renders the show template' do
get :show, params: { username: user.username }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('show')
end
end
......@@ -53,7 +53,7 @@ describe UsersController do
it 'renders show' do
get :show, params: { username: user.username }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('show')
end
end
......@@ -74,7 +74,7 @@ describe UsersController do
it 'renders 404' do
get :show, params: { username: 'nonexistent' }
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......@@ -130,7 +130,7 @@ describe UsersController do
get :calendar, params: { username: public_user.username }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
......@@ -285,7 +285,7 @@ describe UsersController do
context 'format html' do
it 'renders snippets page' do
get :snippets, params: { username: user.username }
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('show')
end
end
......@@ -293,7 +293,7 @@ describe UsersController do
context 'format json' do
it 'response with snippets json data' do
get :snippets, params: { username: user.username }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to have_key('html')
end
end
......
<?xml version="1.0"?>
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="jVFQbyEpSfUwqhZtJtarIaGoshwuAQMDwLoiMhzJXsv" Version="2.0" IssueInstant="2020-01-23T06:12:41.896Z" Destination="https://gitlab-example.com/users/auth/saml/callback" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" InResponseTo="feooghajnhofcmogakmlhpkohnmikicnfhdnjlc">
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://example.com/adfs/services/trust</Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<Assertion xmlns="urn:oasis:names:tc:SAML:2.0:assertion" ID="emmCjammnYdAbMWDuMAJeZvQIMBayeeYqqwvQoDclKE" IssueInstant="2020-01-23T06:12:41.896Z" Version="2.0">
<Issuer>https://example.com/adfs/services/trust</Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="#jVFQbyEpSfUwqhZtJtarIaGoshwuAQMDwLoiMhzJXsv">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>uHuSry39P16Yh7srS32xESmj4Lw</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>fdghdfggfd=</ds:SignatureValue>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>dfghjkl</ds:X509Certificate>
</ds:X509Data>
</KeyInfo>
</ds:Signature>
<Subject>
<NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient">example@example.com</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<SubjectConfirmationData InResponseTo="cfeooghajnhofcmogakmlhpkohnmikicnfhdnjlc" NotOnOrAfter="2020-01-23T06:17:41.896Z" Recipient="https://gitlab-example.com/users/auth/saml/callback"/>
</SubjectConfirmation>
</Subject>
<Conditions NotBefore="2020-01-23T06:10:41.818Z" NotOnOrAfter="2020-01-23T07:10:41.818Z">
<AudienceRestriction>
<Audience>https://gitlab-example.com</Audience>
</AudienceRestriction>
</Conditions>
<AttributeStatement>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
<AttributeValue>example@example.com</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name">
<AttributeValue>Example User</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.xmlsoap.org/claims/Group">
<AttributeValue>Group 1</AttributeValue>
<AttributeValue>Another Group</AttributeValue>
</Attribute>
</AttributeStatement>
<AuthnStatement AuthnInstant="2020-01-23T06:12:41.756Z" SessionIndex="perdkjfskdjfksdiertusfsdfsddeurtherukjdfgkdffg">
<AuthnContext>
<AuthnContextClassRef>urn:federation:authentication:windows</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>
</samlp:Response>
......@@ -97,7 +97,7 @@ describe('IDE services', () => {
mock
.onGet(
`${relativeUrlRoot}/${TEST_PROJECT_ID}/raw/${TEST_COMMIT_SHA}/${escapeFileUrl(
`${relativeUrlRoot}/${TEST_PROJECT_ID}/-/raw/${TEST_COMMIT_SHA}/${escapeFileUrl(
filePath,
)}`,
)
......
......@@ -32,8 +32,8 @@ describe('Repository parent row component', () => {
it.each`
path | to
${'app'} | ${'/tree/master/'}
${'app/assets'} | ${'/tree/master/app'}
${'app'} | ${'/-/tree/master/'}
${'app/assets'} | ${'/-/tree/master/app'}
`('renders link in $path to $to', ({ path, to }) => {
factory(path);
......@@ -48,7 +48,7 @@ describe('Repository parent row component', () => {
vm.find('td').trigger('click');
expect($router.push).toHaveBeenCalledWith({
path: '/tree/master/app',
path: '/-/tree/master/app',
});
});
......@@ -60,7 +60,7 @@ describe('Repository parent row component', () => {
vm.find('a').trigger('click');
expect($router.push).not.toHaveBeenCalledWith({
path: '/tree/master/app',
path: '/-/tree/master/app',
});
});
......
......@@ -88,7 +88,7 @@ describe('Repository table row component', () => {
vm.trigger('click');
if (pushes) {
expect($router.push).toHaveBeenCalledWith({ path: '/tree/master/test' });
expect($router.push).toHaveBeenCalledWith({ path: '/-/tree/master/test' });
} else {
expect($router.push).not.toHaveBeenCalled();
}
......
......@@ -4,11 +4,11 @@ import createRouter from '~/repository/router';
describe('Repository router spec', () => {
it.each`
path | component | componentName
${'/'} | ${IndexPage} | ${'IndexPage'}
${'/tree/master'} | ${TreePage} | ${'TreePage'}
${'/tree/master/app/assets'} | ${TreePage} | ${'TreePage'}
${'/tree/123/app/assets'} | ${null} | ${'null'}
path | component | componentName
${'/'} | ${IndexPage} | ${'IndexPage'}
${'/-/tree/master'} | ${TreePage} | ${'TreePage'}
${'/-/tree/master/app/assets'} | ${TreePage} | ${'TreePage'}
${'/-/tree/123/app/assets'} | ${null} | ${'null'}
`('sets component as $componentName for path "$path"', ({ path, component }) => {
const router = createRouter('', 'master');
......
......@@ -56,7 +56,7 @@ describe BlobHelper do
stub_feature_flags(web_ide_default: false)
link = helper.edit_blob_button(project, 'master', 'README.md')
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/edit/master/README.md")
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/-/edit/master/README.md")
end
it 'returns a link with a Web IDE route' do
......@@ -69,7 +69,7 @@ describe BlobHelper do
stub_feature_flags(web_ide_default: false)
link = helper.edit_blob_button(project, 'master', 'README.md', link_opts: { mr_id: 10 })
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/edit/master/README.md?mr_id=10")
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/-/edit/master/README.md?mr_id=10")
end
end
......
......@@ -103,7 +103,7 @@ describe MarkupHelper do
let(:requested_path) { 'files/images/README.md' }
it 'returns the correct HTML for the image' do
expanded_path = "/#{project.full_path}/raw/master/files/images/#{image_file}"
expanded_path = "/#{project.full_path}/-/raw/master/files/images/#{image_file}"
expect(subject.css('a')[0].attr('href')).to eq(expanded_path)
expect(subject.css('img')[0].attr('data-src')).to eq(expanded_path)
......
......@@ -100,34 +100,34 @@ describe SubmoduleHelper do
allow(repo).to receive(:project).and_return(project)
stub_url('./')
expect(subject).to eq(["/master-project/#{project.path}", "/master-project/#{project.path}/tree/hash"])
expect(subject).to eq(["/master-project/#{project.path}", "/master-project/#{project.path}/-/tree/hash"])
end
end
context 'submodule on gitlab.com' do
it 'detects ssh' do
stub_url('git@gitlab.com:gitlab-org/gitlab-foss.git')
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash'])
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/-/tree/hash'])
end
it 'detects http' do
stub_url('http://gitlab.com/gitlab-org/gitlab-foss.git')
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash'])
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/-/tree/hash'])
end
it 'detects https' do
stub_url('https://gitlab.com/gitlab-org/gitlab-foss.git')
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash'])
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/-/tree/hash'])
end
it 'handles urls with no .git on the end' do
stub_url('http://gitlab.com/gitlab-org/gitlab-foss')
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash'])
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/-/tree/hash'])
end
it 'handles urls with trailing whitespace' do
stub_url('http://gitlab.com/gitlab-org/gitlab-foss.git ')
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash'])
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/-/tree/hash'])
end
it 'returns original with non-standard url' do
......@@ -171,7 +171,7 @@ describe SubmoduleHelper do
stub_url(relative_path)
result = subject
expect(result).to eq([expected_path, "#{expected_path}/tree/#{submodule_item.id}"])
expect(result).to eq([expected_path, "#{expected_path}/-/tree/#{submodule_item.id}"])
end
it 'handles project under same group' do
......
......@@ -38,11 +38,11 @@ describe('DiffViewer', () => {
setTimeout(() => {
expect(vm.$el.querySelector('.deleted img').getAttribute('src')).toBe(
`//raw/DEF/${RED_BOX_IMAGE_URL}`,
`//-/raw/DEF/${RED_BOX_IMAGE_URL}`,
);
expect(vm.$el.querySelector('.added img').getAttribute('src')).toBe(
`//raw/ABC/${GREEN_BOX_IMAGE_URL}`,
`//-/raw/ABC/${GREEN_BOX_IMAGE_URL}`,
);
done();
......
import { shallowMount, createLocalVue } from '@vue/test-utils';
import GraphqlPagination from '~/vue_shared/components/pagination/graphql_pagination.vue';
const localVue = createLocalVue();
describe('Graphql Pagination component', () => {
let wrapper;
function factory({ hasNextPage = true, hasPreviousPage = true }) {
wrapper = shallowMount(localVue.extend(GraphqlPagination), {
propsData: {
hasNextPage,
hasPreviousPage,
},
localVue,
});
}
afterEach(() => {
wrapper.destroy();
});
describe('without previous page', () => {
beforeEach(() => {
factory({ hasPreviousPage: false });
});
it('renders disabled previous button', () => {
expect(wrapper.find('.js-prev-btn').attributes().disabled).toEqual('true');
});
});
describe('with previous page', () => {
beforeEach(() => {
factory({ hasPreviousPage: true });
});
it('renders enabled previous button', () => {
expect(wrapper.find('.js-prev-btn').attributes().disabled).toEqual(undefined);
});
it('emits previousClicked on click', () => {
wrapper.find('.js-prev-btn').vm.$emit('click');
expect(wrapper.emitted().previousClicked.length).toBe(1);
});
});
describe('without next page', () => {
beforeEach(() => {
factory({ hasNextPage: false });
});
it('renders disabled next button', () => {
expect(wrapper.find('.js-next-btn').attributes().disabled).toEqual('true');
});
});
describe('with next page', () => {
beforeEach(() => {
factory({ hasNextPage: true });
});
it('renders enabled next button', () => {
expect(wrapper.find('.js-next-btn').attributes().disabled).toEqual(undefined);
});
it('emits nextClicked on click', () => {
wrapper.find('.js-next-btn').vm.$emit('click');
expect(wrapper.emitted().nextClicked.length).toBe(1);
});
});
});
......@@ -152,7 +152,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
it 'rebuilds absolute URL for a file in the repo' do
doc = filter(link('/doc/api/README.md'))
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
.to eq "/#{project_path}/-/blob/#{ref}/doc/api/README.md"
end
it 'does not modify relative URLs in system notes' do
......@@ -170,13 +170,13 @@ describe Banzai::Filter::RepositoryLinkFilter do
it 'rebuilds relative URL for a file in the repo' do
doc = filter(link('doc/api/README.md'))
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
.to eq "/#{project_path}/-/blob/#{ref}/doc/api/README.md"
end
it 'rebuilds relative URL for a file in the repo with leading ./' do
doc = filter(link('./doc/api/README.md'))
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
.to eq "/#{project_path}/-/blob/#{ref}/doc/api/README.md"
end
it 'rebuilds relative URL for a file in the repo up one directory' do
......@@ -184,7 +184,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
doc = filter(relative_link, requested_path: 'doc/update/7.14-to-8.0.md')
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
.to eq "/#{project_path}/-/blob/#{ref}/doc/api/README.md"
end
it 'rebuilds relative URL for a file in the repo up multiple directories' do
......@@ -192,7 +192,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
doc = filter(relative_link, requested_path: 'doc/foo/bar/baz/README.md')
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/blob/#{ref}/doc/api/README.md"
.to eq "/#{project_path}/-/blob/#{ref}/doc/api/README.md"
end
it 'rebuilds relative URL for a file in the repository root' do
......@@ -200,47 +200,47 @@ describe Banzai::Filter::RepositoryLinkFilter do
doc = filter(relative_link, requested_path: 'doc/some-file.md')
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/blob/#{ref}/README.md"
.to eq "/#{project_path}/-/blob/#{ref}/README.md"
end
it 'rebuilds relative URL for a file in the repo with an anchor' do
doc = filter(link('README.md#section'))
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/blob/#{ref}/README.md#section"
.to eq "/#{project_path}/-/blob/#{ref}/README.md#section"
end
it 'rebuilds relative URL for a directory in the repo' do
doc = filter(link('doc/api/'))
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/tree/#{ref}/doc/api"
.to eq "/#{project_path}/-/tree/#{ref}/doc/api"
end
it 'rebuilds relative URL for an image in the repo' do
doc = filter(image('files/images/logo-black.png'))
expect(doc.at_css('img')['src'])
.to eq "/#{project_path}/raw/#{ref}/files/images/logo-black.png"
.to eq "/#{project_path}/-/raw/#{ref}/files/images/logo-black.png"
end
it 'rebuilds relative URL for link to an image in the repo' do
doc = filter(link('files/images/logo-black.png'))
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/raw/#{ref}/files/images/logo-black.png"
.to eq "/#{project_path}/-/raw/#{ref}/files/images/logo-black.png"
end
it 'rebuilds relative URL for a video in the repo' do
doc = filter(video('files/videos/intro.mp4'), commit: project.commit('video'), ref: 'video')
expect(doc.at_css('video')['src'])
.to eq "/#{project_path}/raw/video/files/videos/intro.mp4"
.to eq "/#{project_path}/-/raw/video/files/videos/intro.mp4"
end
it 'rebuilds relative URL for audio in the repo' do
doc = filter(audio('files/audio/sample.wav'), commit: project.commit('audio'), ref: 'audio')
expect(doc.at_css('audio')['src'])
.to eq "/#{project_path}/raw/audio/files/audio/sample.wav"
.to eq "/#{project_path}/-/raw/audio/files/audio/sample.wav"
end
it 'does not modify relative URL with an anchor only' do
......@@ -267,7 +267,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
allow_any_instance_of(described_class).to receive(:uri_type).and_return(:raw)
doc = filter(image(escaped))
expect(doc.at_css('img')['src']).to eq "/#{project_path}/raw/#{Addressable::URI.escape(ref)}/#{escaped}"
expect(doc.at_css('img')['src']).to eq "/#{project_path}/-/raw/#{Addressable::URI.escape(ref)}/#{escaped}"
end
context 'when requested path is a file in the repo' do
......@@ -275,7 +275,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
it 'rebuilds URL relative to the containing directory' do
doc = filter(link('users.md'))
expect(doc.at_css('a')['href']).to eq "/#{project_path}/blob/#{Addressable::URI.escape(ref)}/doc/api/users.md"
expect(doc.at_css('a')['href']).to eq "/#{project_path}/-/blob/#{Addressable::URI.escape(ref)}/doc/api/users.md"
end
end
......@@ -284,7 +284,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
it 'rebuilds URL relative to the directory' do
doc = filter(link('users.md'))
expect(doc.at_css('a')['href']).to eq "/#{project_path}/blob/#{Addressable::URI.escape(ref)}/doc/api/users.md"
expect(doc.at_css('a')['href']).to eq "/#{project_path}/-/blob/#{Addressable::URI.escape(ref)}/doc/api/users.md"
end
end
......@@ -295,7 +295,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
it 'correctly escapes the ref' do
doc = filter(link('.gitkeep'))
expect(doc.at_css('a')['href']).to eq "/#{project_path}/blob/#{Addressable::URI.escape(ref)}/foo/bar/.gitkeep"
expect(doc.at_css('a')['href']).to eq "/#{project_path}/-/blob/#{Addressable::URI.escape(ref)}/foo/bar/.gitkeep"
end
end
......@@ -314,7 +314,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
doc = filter(link(path))
expect(doc.at_css('a')['href'])
.to eq "/#{project_path}/raw/#{ref_escaped}/files/images/logo-black.png"
.to eq "/#{project_path}/-/raw/#{ref_escaped}/files/images/logo-black.png"
end
end
......@@ -325,7 +325,7 @@ describe Banzai::Filter::RepositoryLinkFilter do
it 'does not escape the space twice' do
doc = filter(link('README.md'))
expect(doc.at_css('a')['href']).to eq "/#{project_path}/blob/#{Addressable::URI.escape(ref)}/with%20space/README.md"
expect(doc.at_css('a')['href']).to eq "/#{project_path}/-/blob/#{Addressable::URI.escape(ref)}/with%20space/README.md"
end
end
end
......
......@@ -31,7 +31,7 @@ describe ExtractsPath do
it "log tree path has no escape sequences" do
assign_ref_vars
expect(@logs_path).to eq("/#{@project.full_path}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
expect(@logs_path).to eq("/#{@project.full_path}/-/refs/#{ref}/logs_tree/files/ruby/popen.rb")
end
context 'ref contains %20' do
......
......@@ -95,6 +95,17 @@ describe Gitlab::Auth::Saml::AuthHash do
end
end
context 'with ADFS SAML response_object' do
before do
auth_hash_data[:extra][:response_object] = { document:
saml_xml(File.read('spec/fixtures/authentication/adfs_saml_response.xml')) }
end
it 'can extract authn_context' do
expect(saml_auth_hash.authn_context).to eq 'urn:federation:authentication:windows'
end
end
context 'without response_object' do
it 'returns an empty string' do
expect(saml_auth_hash.authn_context).to be_nil
......
......@@ -258,7 +258,7 @@ FILE
describe '#as_json' do
it 'includes the blob path for the file' do
expect(conflict_file.as_json[:blob_path])
.to eq("/#{project.full_path}/blob/#{our_commit.oid}/files/ruby/regex.rb")
.to eq("/#{project.full_path}/-/blob/#{our_commit.oid}/files/ruby/regex.rb")
end
it 'includes the blob icon for the file' do
......
......@@ -75,8 +75,8 @@ describe Gitlab::DependencyLinker::GodepsJsonLinker do
end
it 'links GitLab projects' do
expect(subject).to include(link('gitlab.com/group/project/path', 'https://gitlab.com/group/project/tree/master/path'))
expect(subject).to include(link('gitlab.com/group/subgroup/project.git/path', 'https://gitlab.com/group/subgroup/project/tree/master/path'))
expect(subject).to include(link('gitlab.com/group/project/path', 'https://gitlab.com/group/project/-/tree/master/path'))
expect(subject).to include(link('gitlab.com/group/subgroup/project.git/path', 'https://gitlab.com/group/subgroup/project/-/tree/master/path'))
end
it 'links Golang packages' do
......
......@@ -21,7 +21,7 @@ describe Gitlab::Graphql::Representation::SubmoduleTreeEntry do
)
expect(entries.map(&:tree_url)).to contain_exactly(
"https://gitlab.com/gitlab-org/gitlab-grack/tree/645f6c4c82fd3f5e06f67134450a570b795e55a6",
"https://gitlab.com/gitlab-org/gitlab-grack/-/tree/645f6c4c82fd3f5e06f67134450a570b795e55a6",
"https://github.com/gitlabhq/gitlab-shell/tree/79bceae69cb5750d6567b223597999bfa91cb3b9",
"https://github.com/randx/six/tree/409f37c4f05865e4fb208c771485f211a22c4c2d"
)
......
......@@ -241,7 +241,7 @@ describe Gitlab::Middleware::Go do
project_url = "http://#{Gitlab.config.gitlab.host}/#{path}"
expect(response[0]).to eq(200)
expect(response[1]['Content-Type']).to eq('text/html')
expected_body = %{<html><head><meta name="go-import" content="#{Gitlab.config.gitlab.host}/#{path} git #{repository_url}" /><meta name="go-source" content="#{Gitlab.config.gitlab.host}/#{path} #{project_url} #{project_url}/tree/#{branch}{/dir} #{project_url}/blob/#{branch}{/dir}/{file}#L{line}" /></head><body>go get #{Gitlab.config.gitlab.url}/#{path}</body></html>}
expected_body = %{<html><head><meta name="go-import" content="#{Gitlab.config.gitlab.host}/#{path} git #{repository_url}" /><meta name="go-source" content="#{Gitlab.config.gitlab.host}/#{path} #{project_url} #{project_url}/-/tree/#{branch}{/dir} #{project_url}/-/blob/#{branch}{/dir}/{file}#L{line}" /></head><body>go get #{Gitlab.config.gitlab.url}/#{path}</body></html>}
expect(response[2].body).to eq([expected_body])
end
end
......
......@@ -38,7 +38,7 @@ describe Gitlab::SubmoduleLinks do
end
it 'returns links and caches the by ref' do
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash'])
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/-/tree/hash'])
cache_store = links.instance_variable_get("@cache_store")
......@@ -49,7 +49,7 @@ describe Gitlab::SubmoduleLinks do
let(:ref) { 'signed-commits' }
it 'returns links' do
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash'])
expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/-/tree/hash'])
end
end
end
......
......@@ -189,7 +189,7 @@ describe Key, :mailer do
it 'removes key from authorized_file' do
key = create(:personal_key)
expect(GitlabShellWorker).to receive(:perform_async).with(:remove_key, key.shell_id, key.key)
expect(GitlabShellWorker).to receive(:perform_async).with(:remove_key, key.shell_id)
key.destroy
end
end
......
......@@ -725,7 +725,7 @@ describe Project do
let(:project) { create(:project, :repository) }
it 'returns the README' do
expect(project.readme_url).to eq("#{project.web_url}/blob/master/README.md")
expect(project.readme_url).to eq("#{project.web_url}/-/blob/master/README.md")
end
end
end
......
......@@ -1817,10 +1817,28 @@ describe Repository do
end
describe '#after_import' do
subject { repository.after_import }
it 'flushes and builds the cache' do
expect(repository).to receive(:expire_content_cache)
repository.after_import
subject
end
it 'calls DetectRepositoryLanguagesWorker' do
expect(DetectRepositoryLanguagesWorker).to receive(:perform_async)
subject
end
context 'with a wiki repository' do
let(:repository) { project.wiki.repository }
it 'does not call DetectRepositoryLanguagesWorker' do
expect(DetectRepositoryLanguagesWorker).not_to receive(:perform_async)
subject
end
end
end
......
......@@ -21,7 +21,7 @@ describe BlobPresenter, :seed_helper do
subject { described_class.new(blob) }
it { expect(subject.web_url).to eq("http://localhost/#{project.full_path}/blob/#{blob.commit_id}/#{blob.path}") }
it { expect(subject.web_url).to eq("http://localhost/#{project.full_path}/-/blob/#{blob.commit_id}/#{blob.path}") }
end
describe '#highlight' do
......
......@@ -334,7 +334,7 @@ describe MergeRequestPresenter do
allow(resource).to receive(:target_branch_exists?) { true }
is_expected
.to eq("/#{resource.target_project.full_path}/commits/#{resource.target_branch}")
.to eq("/#{resource.target_project.full_path}/-/commits/#{resource.target_branch}")
end
end
......@@ -358,7 +358,7 @@ describe MergeRequestPresenter do
allow(resource).to receive(:source_branch_exists?) { true }
is_expected
.to eq("/#{resource.source_project.full_path}/commits/#{resource.source_branch}")
.to eq("/#{resource.source_project.full_path}/-/commits/#{resource.source_branch}")
end
end
......@@ -382,7 +382,7 @@ describe MergeRequestPresenter do
allow(resource).to receive(:target_branch_exists?) { true }
is_expected
.to eq("/#{resource.target_project.full_path}/tree/#{resource.target_branch}")
.to eq("/#{resource.target_project.full_path}/-/tree/#{resource.target_branch}")
end
end
......@@ -496,7 +496,7 @@ describe MergeRequestPresenter do
allow(resource).to receive(:source_branch_exists?) { true }
is_expected
.to eq("<a href=\"/#{resource.source_project.full_path}/tree/#{resource.source_branch}\">#{resource.source_branch}</a>")
.to eq("<a href=\"/#{resource.source_project.full_path}/-/tree/#{resource.source_branch}\">#{resource.source_branch}</a>")
end
it 'escapes html, when source_branch does not exist' do
......
......@@ -11,6 +11,6 @@ describe TreeEntryPresenter do
let(:presenter) { described_class.new(tree) }
describe '.web_url' do
it { expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/tree/#{tree.commit_id}/#{tree.path}") }
it { expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}") }
end
end
......@@ -812,7 +812,7 @@ describe API::Projects do
post api('/projects', user), params: project
expect(json_response['readme_url']).to eql("#{Gitlab.config.gitlab.url}/#{json_response['namespace']['full_path']}/somewhere/blob/master/README.md")
expect(json_response['readme_url']).to eql("#{Gitlab.config.gitlab.url}/#{json_response['namespace']['full_path']}/somewhere/-/blob/master/README.md")
end
it 'sets tag list to a project' do
......
......@@ -834,7 +834,7 @@ describe 'Git HTTP requests' do
Blob.decorate(Gitlab::Git::Blob.find(project.repository, 'master', 'bar/branch-test.txt'), project)
end
get "/#{project.full_path}/blob/master/info/refs"
get "/#{project.full_path}/-/blob/master/info/refs"
end
it "returns the file" do
......@@ -844,7 +844,7 @@ describe 'Git HTTP requests' do
context "when the file does not exist" do
before do
get "/#{project.full_path}/blob/master/info/refs"
get "/#{project.full_path}/-/blob/master/info/refs"
end
it "redirects" do
......
This diff is collapsed.
......@@ -23,7 +23,7 @@ describe BlobEntity do
mode: "100644",
readable_text: true,
icon: "file-text-o",
url: "/#{project.full_path}/blob/master/bar/branch-test.txt"
url: "/#{project.full_path}/-/blob/master/bar/branch-test.txt"
})
end
end
......
......@@ -60,7 +60,7 @@ describe MergeRequestPollWidgetEntity do
project.add_developer(user)
expect(subject[:new_blob_path])
.to eq("/#{resource.project.full_path}/new/#{resource.source_branch}")
.to eq("/#{resource.project.full_path}/-/new/#{resource.source_branch}")
end
end
......
# frozen_string_literal: true
require 'spec_helper'
describe Ci::CreatePipelineService do
context '.pre/.post stages' do
let_it_be(:user) { create(:admin) }
let_it_be(:project) { create(:project, :repository, creator: user) }
let(:source) { :push }
let(:service) { described_class.new(project, user, { ref: ref }) }
let(:pipeline) { service.execute(source) }
let(:config) do
<<~YAML
validate:
stage: .pre
script: echo Hello World
build:
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "master"
script: echo Hello World
notify:
stage: .post
script: echo Hello World
YAML
end
before do
stub_ci_pipeline_yaml_file(config)
end
context 'when pipeline contains a build except .pre/.post' do
let(:ref) { 'refs/heads/master' }
it 'creates a pipeline' do
expect(pipeline).to be_persisted
expect(pipeline.stages.map(&:name)).to contain_exactly(
*%w(.pre build .post))
expect(pipeline.builds.map(&:name)).to contain_exactly(
*%w(validate build notify))
end
end
context 'when pipeline does not contain any other build except .pre/.post' do
let(:ref) { 'refs/heads/feature' }
it 'does not create a pipeline' do
expect(pipeline).not_to be_persisted
# we can validate a list of stages, as they are assigned
# but not persisted
expect(pipeline.stages.map(&:name)).to contain_exactly(
*%w(.pre .post))
end
end
end
end
......@@ -253,7 +253,7 @@ describe ::SystemNotes::MergeRequestsService do
end
it "posts the 'picked merge request' system note" do
expect(subject.note).to eq("picked this merge request into branch [`#{branch_name}`](/#{project.full_path}/tree/#{branch_name}) with commit #{commit_sha}")
expect(subject.note).to eq("picked this merge request into branch [`#{branch_name}`](/#{project.full_path}/-/tree/#{branch_name}) with commit #{commit_sha}")
end
it 'links the merge request and the cherry-pick commit' do
......
......@@ -40,7 +40,7 @@ describe 'help/index' do
render
expect(rendered).to match '8.0.2'
expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/commits/abcdefg})
expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/-/commits/abcdefg})
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment