Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
7e8278c0f4
commit
db24ab2b72
|
@ -347,6 +347,8 @@ RSpec/HaveGitlabHttpStatus:
|
|||
- 'ee/spec/features/**/*'
|
||||
- 'spec/controllers/*.rb'
|
||||
- 'ee/spec/controllers/*.rb'
|
||||
- 'spec/controllers/projects/*.rb'
|
||||
- 'ee/spec/controllers/projects/*.rb'
|
||||
- 'spec/requests/*.rb'
|
||||
- 'ee/spec/requests/*.rb'
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default () => {
|
|||
// eslint-disable-next-line no-new
|
||||
new BlobLinePermalinkUpdater(
|
||||
document.querySelector('#blob-content-holder'),
|
||||
'.diff-line-num[data-line-number]',
|
||||
'.diff-line-num[data-line-number], .diff-line-num[data-line-number] *',
|
||||
document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'),
|
||||
);
|
||||
|
||||
|
|
|
@ -6,14 +6,24 @@ class SentNotificationsController < ApplicationController
|
|||
def unsubscribe
|
||||
@sent_notification = SentNotification.for(params[:id])
|
||||
|
||||
return render_404 unless @sent_notification && @sent_notification.unsubscribable?
|
||||
return render_404 unless unsubscribe_prerequisites_met?
|
||||
|
||||
return unsubscribe_and_redirect if current_user || params[:force]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unsubscribe_prerequisites_met?
|
||||
@sent_notification.present? &&
|
||||
@sent_notification.unsubscribable? &&
|
||||
noteable.present?
|
||||
end
|
||||
|
||||
def noteable
|
||||
@sent_notification.noteable
|
||||
end
|
||||
|
||||
def unsubscribe_and_redirect
|
||||
noteable = @sent_notification.noteable
|
||||
noteable.unsubscribe(@sent_notification.recipient, @sent_notification.project)
|
||||
|
||||
flash[:notice] = _("You have been unsubscribed from this thread.")
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix 500 error when trying to unsubscribe from an already deleted entity
|
||||
merge_request: 23747
|
||||
author:
|
||||
type: fixed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix hash parameter of Permalink and Blame button
|
||||
merge_request: 23713
|
||||
author:
|
||||
type: fixed
|
|
@ -15,7 +15,7 @@ The Packages feature allows GitLab to act as a repository for the following:
|
|||
|
||||
Don't you see your package management system supported yet?
|
||||
Please consider contributing
|
||||
to GitLab. This [development documentation](../../development/packages.md) will guide you through the process, it includes a list of [suggested contributions](../../development/packages.md#suggested-contributions).
|
||||
to GitLab. This [development documentation](../../development/packages.md) will guide you through the process.
|
||||
|
||||
## Enabling the Packages feature
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ and cross-link between any related content.
|
|||
We employ a **docs-first methodology** to help ensure that the docs remain a complete and trusted resource, and to make communicating about the use of GitLab more efficient.
|
||||
|
||||
- If the answer to a question exists in documentation, share the link to the docs instead of rephrasing the information.
|
||||
- When you encounter new information not available in GitLab’s documentation (for example, when working on a support case or testing a feature), your first step should be to create a merge request to add this information to the docs. You can then share the MR in order to communicate this information.
|
||||
- When you encounter new information not available in GitLab’s documentation (for example, when working on a support case or testing a feature), your first step should be to create a merge request (MR) to add this information to the docs. You can then share the MR in order to communicate this information.
|
||||
|
||||
New information that would be useful toward the future usage or troubleshooting of GitLab should not be written directly in a forum or other messaging system, but added to a docs MR and then referenced, as described above. Note that among any other doc changes, you can always add a Troubleshooting section to a doc if none exists, or un-comment and use the placeholder Troubleshooting section included as part of our [doc template](structure.md#template-for-new-docs), if present.
|
||||
|
||||
|
@ -525,6 +525,35 @@ For other punctuation rules, please refer to the
|
|||
- Use sentence case in headings. Do not capitalize the words of the title, unless
|
||||
it refers to a product feature. For example, capitalizing "issues" is acceptable in
|
||||
`## What you can do with GitLab Issues`, but not in `## Closing multiple issues`.
|
||||
- Our docs site search engine prioritizes headings, therefore, make sure to write
|
||||
headings that contextualize the subject and help to take the user to the right
|
||||
document. For example, `## Examples` is a bad heading; `## GitLab Pages examples`
|
||||
is a better one. It's not an exact science, but please consider this carefully.
|
||||
|
||||
### Anchor links
|
||||
|
||||
Headings generate anchor links automatically when rendered. `## This is an example`
|
||||
generates the anchor `#this-is-an-example`.
|
||||
|
||||
Keep in mind that the GitLab UI links to a large number of docs and respective
|
||||
anchor links to take the user to the right spot. Therefore, when you change a
|
||||
heading, search `doc/*`, `app/views/*`, and `ee/app/views/*` for the old anchor
|
||||
to make sure you're not breaking an anchor linked from other docs nor from the
|
||||
GitLab UI. If you find the old anchor, make sure to replace it with the new one.
|
||||
|
||||
Important:
|
||||
|
||||
- Avoid crosslinking docs to headings unless you need to link to a specific section
|
||||
of the document. This will avoid breaking anchors in the future in case the heading
|
||||
is changed.
|
||||
- If possible, avoid changing headings since they're not only linked internally.
|
||||
There are various links to GitLab documentation on the internet, such as tutorials,
|
||||
presentations, StackOverflow posts, and other sources.
|
||||
- Do not link to `h1` headings.
|
||||
|
||||
Note that, with Kramdown, it is possible to add a custom ID to an HTML element
|
||||
with Markdown markup, but they **do not** work in GitLab's `/help`. Therefore,
|
||||
do not use this option until further notice.
|
||||
|
||||
## Links
|
||||
|
||||
|
@ -953,6 +982,24 @@ Which renders to:
|
|||
To maintain consistency through GitLab documentation, the following guides documentation authors
|
||||
on agreed styles and usage of terms.
|
||||
|
||||
### Merge Requests (MRs)
|
||||
|
||||
Merge requests allow you to exchange changes you made to source code and collaborate
|
||||
with other people on the same project. You'll see this term used in the following ways:
|
||||
|
||||
- If you're referring to the feature, use **Merge Request**.
|
||||
- In any other context, use **merge request**.
|
||||
|
||||
As noted in our corporate [Writing Style Guidelines](https://about.gitlab.com/handbook/communication/#writing-style-guidelines),
|
||||
if you use the **MR** acronym, expand it at least once per document page.
|
||||
For example, the first time you specify a MR, specify either _Merge Request (MR)_ or _merge request (MR)_.
|
||||
|
||||
Examples:
|
||||
|
||||
- "We prefer GitLab Merge Requests".
|
||||
- "Open a merge request to fix a broken link".
|
||||
- "After you open a merge request (MR), submit your MR for review and approval".
|
||||
|
||||
### Describing UI elements
|
||||
|
||||
The following are styles to follow when describing UI elements on a screen:
|
||||
|
|
|
@ -14,29 +14,6 @@ by looking at existing merge requests with Maven and NPM support:
|
|||
- [Maven repository](https://gitlab.com/gitlab-org/gitlab/merge_requests/6607).
|
||||
- [Instance level endpoint for Maven repository](https://gitlab.com/gitlab-org/gitlab/merge_requests/8757)
|
||||
|
||||
## Suggested contributions
|
||||
|
||||
The goal of the Package group is to build a set of features that, within three years, will allow ninety percent of our customers to store all of their packages in GitLab. To do that we need to ensure that we support the below package manager formats.
|
||||
|
||||
| Format | Use case |
|
||||
| ------ | ------ |
|
||||
| [Bower](https://gitlab.com/gitlab-org/gitlab/issues/36888) | Boost your front end development by hosting your own Bower components. |
|
||||
| [Cargo](https://gitlab.com/gitlab-org/gitlab/issues/33060) | Cargo is the Rust package manager. Build, publish and share Rust packages |
|
||||
| [Chef](https://gitlab.com/gitlab-org/gitlab/issues/36889) | Configuration management with Chef using all the benefits of a repository manager. |
|
||||
| [CocoaPods](https://gitlab.com/gitlab-org/gitlab/issues/36890) | Speed up development with Xcode and CocoaPods. |
|
||||
| [Conda](https://gitlab.com/gitlab-org/gitlab/issues/36891) | Secure and private local Conda repositories. |
|
||||
| [CRAN](https://gitlab.com/gitlab-org/gitlab/issues/36892) | Deploy and resolve CRAN packages for the R language. |
|
||||
| [Debian](https://gitlab.com/gitlab-org/gitlab/issues/5835) | Host and provision Debian packages. |
|
||||
| [Go](https://gitlab.com/gitlab-org/gitlab/issues/9773) | Resolve Go dependencies from and publish your Go packages to GitLab. |
|
||||
| [Opkg](https://gitlab.com/gitlab-org/gitlab/issues/36894) | Optimize your work with OpenWrt using Opkg repositories. |
|
||||
| [P2](https://gitlab.com/gitlab-org/gitlab/issues/36895) | Host all your Eclipse plugins in your own GitLab P2 repository. |
|
||||
| [Puppet](https://gitlab.com/gitlab-org/gitlab/issues/36897) | Configuration management meets repository management with Puppet repositories. |
|
||||
| [PyPi](https://gitlab.com/gitlab-org/gitlab/issues/10483) | Host PyPi distributions. |
|
||||
| [RPM](https://gitlab.com/gitlab-org/gitlab/issues/5932) | Distribute RPMs directly from GitLab. |
|
||||
| [RubyGems](https://gitlab.com/gitlab-org/gitlab/issues/803) | Use GitLab to host your own gems. |
|
||||
| [SBT](https://gitlab.com/gitlab-org/gitlab/issues/36898) | Resolve dependencies from and deploy build output to SBT repositories when running SBT builds. |
|
||||
| [Vagrant](https://gitlab.com/gitlab-org/gitlab/issues/36899) | Securely host your Vagrant boxes in local repositories. |
|
||||
|
||||
## General information
|
||||
|
||||
The existing database model requires the following:
|
||||
|
|
|
@ -15,13 +15,29 @@ The Packages feature allows GitLab to act as a repository for the following:
|
|||
| [NPM Registry](npm_registry/index.md) **(PREMIUM)** | The GitLab NPM Registry enables every project in GitLab to have its own space to store [NPM](https://www.npmjs.com/) packages. | 11.7+ |
|
||||
| [NuGet Repository](nuget_repository/index.md) **(PREMIUM)** | *PLANNED* The GitLab NuGet Repository will enable every project in GitLab to have its own space to store [NuGet](https://www.nuget.org/) packages. | 12.8+ |
|
||||
|
||||
TIP: **Tip:**
|
||||
Don't you see your package management system supported yet? Consider contributing
|
||||
to GitLab. This [development documentation](../../development/packages.md) will
|
||||
## Suggested contributions
|
||||
|
||||
Consider contributing to GitLab. This [development documentation](../../development/packages.md) will
|
||||
guide you through the process. Or check out how other members of the community
|
||||
are adding support for [PHP](https://gitlab.com/gitlab-org/gitlab/merge_requests/17417) or [Terraform](https://gitlab.com/gitlab-org/gitlab/merge_requests/18834).
|
||||
|
||||
NOTE: **Note** We are especially interested in adding support for [PyPi](https://gitlab.com/gitlab-org/gitlab/issues/10483), [RubyGems](https://gitlab.com/gitlab-org/gitlab/issues/803), [Debian](https://gitlab.com/gitlab-org/gitlab/issues/5835), and [RPM](https://gitlab.com/gitlab-org/gitlab/issues/5932).
|
||||
| Format | Use case |
|
||||
| ------ | ------ |
|
||||
| [Cargo](https://gitlab.com/gitlab-org/gitlab/issues/33060) | Cargo is the Rust package manager. Build, publish and share Rust packages |
|
||||
| [Chef](https://gitlab.com/gitlab-org/gitlab/issues/36889) | Configuration management with Chef using all the benefits of a repository manager. |
|
||||
| [CocoaPods](https://gitlab.com/gitlab-org/gitlab/issues/36890) | Speed up development with Xcode and CocoaPods. |
|
||||
| [Conda](https://gitlab.com/gitlab-org/gitlab/issues/36891) | Secure and private local Conda repositories. |
|
||||
| [CRAN](https://gitlab.com/gitlab-org/gitlab/issues/36892) | Deploy and resolve CRAN packages for the R language. |
|
||||
| [Debian](https://gitlab.com/gitlab-org/gitlab/issues/5835) | Host and provision Debian packages. |
|
||||
| [Go](https://gitlab.com/gitlab-org/gitlab/issues/9773) | Resolve Go dependencies from and publish your Go packages to GitLab. |
|
||||
| [Opkg](https://gitlab.com/gitlab-org/gitlab/issues/36894) | Optimize your work with OpenWrt using Opkg repositories. |
|
||||
| [P2](https://gitlab.com/gitlab-org/gitlab/issues/36895) | Host all your Eclipse plugins in your own GitLab P2 repository. |
|
||||
| [Puppet](https://gitlab.com/gitlab-org/gitlab/issues/36897) | Configuration management meets repository management with Puppet repositories. |
|
||||
| [PyPi](https://gitlab.com/gitlab-org/gitlab/issues/10483) | Host PyPi distributions. |
|
||||
| [RPM](https://gitlab.com/gitlab-org/gitlab/issues/5932) | Distribute RPMs directly from GitLab. |
|
||||
| [RubyGems](https://gitlab.com/gitlab-org/gitlab/issues/803) | Use GitLab to host your own gems. |
|
||||
| [SBT](https://gitlab.com/gitlab-org/gitlab/issues/36898) | Resolve dependencies from and deploy build output to SBT repositories when running SBT builds. |
|
||||
| [Vagrant](https://gitlab.com/gitlab-org/gitlab/issues/36899) | Securely host your Vagrant boxes in local repositories. |
|
||||
|
||||
## Package workflows
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
module API
|
||||
class GroupExport < Grape::API
|
||||
before do
|
||||
not_found! unless Feature.enabled?(:group_import_export, user_group, default_enabled: true)
|
||||
|
||||
authorize! :admin_group, user_group
|
||||
end
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ module API
|
|||
SCOPE_ENTITY[params[:scope].to_sym]
|
||||
end
|
||||
|
||||
def verify_search_scope!
|
||||
def verify_search_scope!(resource:)
|
||||
# In EE we have additional validation requirements for searches.
|
||||
# Defining this method here as a noop allows us to easily extend it in
|
||||
# EE, without having to modify this file directly.
|
||||
|
@ -73,7 +73,7 @@ module API
|
|||
use :pagination
|
||||
end
|
||||
get do
|
||||
verify_search_scope!
|
||||
verify_search_scope!(resource: nil)
|
||||
check_users_search_allowed!
|
||||
|
||||
present search, with: entity
|
||||
|
@ -94,7 +94,7 @@ module API
|
|||
use :pagination
|
||||
end
|
||||
get ':id/(-/)search' do
|
||||
verify_search_scope!
|
||||
verify_search_scope!(resource: user_group)
|
||||
check_users_search_allowed!
|
||||
|
||||
present search(group_id: user_group.id), with: entity
|
||||
|
|
|
@ -12,12 +12,6 @@ module QA
|
|||
|
||||
yield
|
||||
|
||||
# Workaround for a bug preventing sign out from secondary nodes
|
||||
# See https://gitlab.com/gitlab-org/gitlab/issues/198289
|
||||
if address == :geo_secondary
|
||||
Runtime::Browser.visit(:geo_primary, Page::Dashboard::Projects)
|
||||
end
|
||||
|
||||
Page::Main::Menu.perform(&:sign_out)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
context 'Create', quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/196034' do
|
||||
context 'Create' do
|
||||
describe 'Web IDE file templates' do
|
||||
include Runtime::Fixtures
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ describe Projects::ArtifactsController do
|
|||
it 'returns 404' do
|
||||
download_artifact(file_type: file_type)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -236,7 +236,7 @@ describe Projects::ArtifactsController do
|
|||
it 'renders the file view' do
|
||||
get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -302,7 +302,7 @@ describe Projects::ArtifactsController do
|
|||
it 'renders the file view' do
|
||||
get :file, params: { namespace_id: private_project.namespace, project_id: private_project, job_id: job, path: 'ci_artifacts.txt' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -317,7 +317,7 @@ describe Projects::ArtifactsController do
|
|||
it 'serves the file using workhorse' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(send_data).to start_with('artifacts-entry:')
|
||||
|
||||
expect(params.keys).to eq(%w(Archive Entry))
|
||||
|
|
|
@ -65,7 +65,7 @@ describe Projects::AutocompleteSourcesController do
|
|||
|
||||
get :milestones, format: :json, params: { namespace_id: group.path, project_id: project.path }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ describe Projects::AvatarsController do
|
|||
it 'shows 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,7 @@ describe Projects::AvatarsController do
|
|||
it 'sends the avatar' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.header['Content-Disposition']).to eq('inline')
|
||||
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
|
||||
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
|
||||
|
|
|
@ -232,7 +232,7 @@ describe Projects::BlobController do
|
|||
end
|
||||
|
||||
it 'redirects to blob show' do
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -246,7 +246,7 @@ describe Projects::BlobController do
|
|||
end
|
||||
|
||||
it 'redirects to blob show' do
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ describe Projects::BoardsController do
|
|||
it 'returns a not found 404 response' do
|
||||
list_boards
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.content_type).to eq 'text/html'
|
||||
end
|
||||
end
|
||||
|
@ -82,7 +82,7 @@ describe Projects::BoardsController do
|
|||
it 'returns a not found 404 response' do
|
||||
list_boards format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
end
|
||||
end
|
||||
|
@ -94,7 +94,7 @@ describe Projects::BoardsController do
|
|||
it 'returns a not found 404 response' do
|
||||
list_boards
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -137,7 +137,7 @@ describe Projects::BoardsController do
|
|||
it 'returns a not found 404 response' do
|
||||
read_board board: board
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.content_type).to eq 'text/html'
|
||||
end
|
||||
end
|
||||
|
@ -174,7 +174,7 @@ describe Projects::BoardsController do
|
|||
it 'returns a not found 404 response' do
|
||||
read_board board: board, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
end
|
||||
end
|
||||
|
@ -186,7 +186,7 @@ describe Projects::BoardsController do
|
|||
|
||||
read_board board: another_board
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ describe Projects::BranchesController do
|
|||
}
|
||||
|
||||
expect(response.location).to include(project_new_blob_path(project, branch))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -238,7 +238,7 @@ describe Projects::BranchesController do
|
|||
}
|
||||
|
||||
expect(response.location).to include(project_new_blob_path(project, branch))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -289,7 +289,7 @@ describe Projects::BranchesController do
|
|||
it 'returns a successful 200 response' do
|
||||
create_branch name: 'my-branch', ref: 'master'
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'returns the created branch' do
|
||||
|
@ -303,7 +303,7 @@ describe Projects::BranchesController do
|
|||
it 'returns an unprocessable entity 422 response' do
|
||||
create_branch name: "<script>alert('merge');</script>", ref: "<script>alert('ref');</script>"
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -335,7 +335,7 @@ describe Projects::BranchesController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(303)
|
||||
expect(response).to have_gitlab_http_status(:see_other)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -361,28 +361,28 @@ describe Projects::BranchesController do
|
|||
context "valid branch name, valid source" do
|
||||
let(:branch) { "feature" }
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(200) }
|
||||
it { expect(response).to have_gitlab_http_status(:ok) }
|
||||
it { expect(response.body).to be_blank }
|
||||
end
|
||||
|
||||
context "valid branch name with unencoded slashes" do
|
||||
let(:branch) { "improve/awesome" }
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(200) }
|
||||
it { expect(response).to have_gitlab_http_status(:ok) }
|
||||
it { expect(response.body).to be_blank }
|
||||
end
|
||||
|
||||
context "valid branch name with encoded slashes" do
|
||||
let(:branch) { "improve%2Fawesome" }
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(200) }
|
||||
it { expect(response).to have_gitlab_http_status(:ok) }
|
||||
it { expect(response.body).to be_blank }
|
||||
end
|
||||
|
||||
context "invalid branch name, valid ref" do
|
||||
let(:branch) { "no-branch" }
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(404) }
|
||||
it { expect(response).to have_gitlab_http_status(:not_found) }
|
||||
it { expect(response.body).to be_blank }
|
||||
end
|
||||
end
|
||||
|
@ -398,7 +398,7 @@ describe Projects::BranchesController do
|
|||
expect(json_response).to eql("message" => 'Branch was deleted')
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(200) }
|
||||
it { expect(response).to have_gitlab_http_status(:ok) }
|
||||
end
|
||||
|
||||
context 'valid branch name with unencoded slashes' do
|
||||
|
@ -408,7 +408,7 @@ describe Projects::BranchesController do
|
|||
expect(json_response).to eql('message' => 'Branch was deleted')
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(200) }
|
||||
it { expect(response).to have_gitlab_http_status(:ok) }
|
||||
end
|
||||
|
||||
context "valid branch name with encoded slashes" do
|
||||
|
@ -418,7 +418,7 @@ describe Projects::BranchesController do
|
|||
expect(json_response).to eql('message' => 'Branch was deleted')
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(200) }
|
||||
it { expect(response).to have_gitlab_http_status(:ok) }
|
||||
end
|
||||
|
||||
context 'invalid branch name, valid ref' do
|
||||
|
@ -428,7 +428,7 @@ describe Projects::BranchesController do
|
|||
expect(json_response).to eql('message' => 'No such branch')
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(404) }
|
||||
it { expect(response).to have_gitlab_http_status(:not_found) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -478,7 +478,7 @@ describe Projects::BranchesController do
|
|||
it 'responds with status 404' do
|
||||
destroy_all_merged
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -519,7 +519,7 @@ describe Projects::BranchesController do
|
|||
state: 'all'
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -537,7 +537,7 @@ describe Projects::BranchesController do
|
|||
state: 'all'
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -594,7 +594,7 @@ describe Projects::BranchesController do
|
|||
names: %w[fix add-pdf-file branch-merged]
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to eq(
|
||||
"fix" => { "behind" => 29, "ahead" => 2 },
|
||||
"branch-merged" => { "behind" => 1, "ahead" => 0 },
|
||||
|
@ -612,7 +612,7 @@ describe Projects::BranchesController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response.count).to be > 1
|
||||
end
|
||||
|
||||
|
@ -629,7 +629,7 @@ describe Projects::BranchesController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
expect(json_response['error']).to eq("Specify at least one and at most #{Kaminari.config.default_per_page} branch names")
|
||||
end
|
||||
|
||||
|
@ -642,7 +642,7 @@ describe Projects::BranchesController do
|
|||
names: %w[fix add-pdf-file branch-merged]
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response.count).to be > 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -648,7 +648,7 @@ describe Projects::ClustersController do
|
|||
go(format: :json)
|
||||
|
||||
cluster.reload
|
||||
expect(response).to have_http_status(:no_content)
|
||||
expect(response).to have_gitlab_http_status(:no_content)
|
||||
expect(cluster.enabled).to be_falsey
|
||||
expect(cluster.name).to eq('my-new-cluster-name')
|
||||
expect(cluster).not_to be_managed
|
||||
|
@ -671,7 +671,7 @@ describe Projects::ClustersController do
|
|||
it "rejects changes" do
|
||||
go(format: :json)
|
||||
|
||||
expect(response).to have_http_status(:bad_request)
|
||||
expect(response).to have_gitlab_http_status(:bad_request)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -179,7 +179,7 @@ describe Projects::CommitController do
|
|||
})
|
||||
|
||||
expect(response).not_to be_successful
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -236,7 +236,7 @@ describe Projects::CommitController do
|
|||
})
|
||||
|
||||
expect(response).not_to be_successful
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -322,7 +322,7 @@ describe Projects::CommitController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -334,7 +334,7 @@ describe Projects::CommitController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -345,7 +345,7 @@ describe Projects::CommitController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -393,7 +393,7 @@ describe Projects::CommitController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -108,7 +108,7 @@ describe Projects::CompareController do
|
|||
show_request
|
||||
|
||||
expect(flash[:alert]).to eq('Invalid branch name')
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,7 +120,7 @@ describe Projects::CompareController do
|
|||
show_request
|
||||
|
||||
expect(flash[:alert]).to eq('Invalid branch name')
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -164,7 +164,7 @@ describe Projects::CompareController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -176,7 +176,7 @@ describe Projects::CompareController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -187,7 +187,7 @@ describe Projects::CompareController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -197,7 +197,7 @@ describe Projects::CompareController do
|
|||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -301,7 +301,7 @@ describe Projects::CompareController do
|
|||
it 'returns only the commit with a signature' do
|
||||
signatures_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
signatures = json_response['signatures']
|
||||
|
||||
expect(signatures.size).to eq(1)
|
||||
|
@ -318,7 +318,7 @@ describe Projects::CompareController do
|
|||
it 'returns a 404' do
|
||||
signatures_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -330,7 +330,7 @@ describe Projects::CompareController do
|
|||
it 'returns no signatures' do
|
||||
signatures_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['signatures']).to be_empty
|
||||
end
|
||||
end
|
||||
|
@ -342,7 +342,7 @@ describe Projects::CompareController do
|
|||
it 'returns no signatures' do
|
||||
signatures_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['signatures']).to be_empty
|
||||
end
|
||||
end
|
||||
|
|
|
@ -122,7 +122,7 @@ describe Projects::DeployKeysController do
|
|||
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.not_to change { DeployKeysProject.count }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
@ -137,7 +137,7 @@ describe Projects::DeployKeysController do
|
|||
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.not_to change { DeployKeysProject.count }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -152,14 +152,14 @@ describe Projects::DeployKeysController do
|
|||
end.to change { DeployKeysProject.count }.by(1)
|
||||
|
||||
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
|
||||
end
|
||||
|
||||
it 'returns 404' do
|
||||
put :enable, params: { id: 0, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -174,7 +174,7 @@ describe Projects::DeployKeysController do
|
|||
end.to change { DeployKeysProject.count }.by(1)
|
||||
|
||||
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
|
||||
end
|
||||
end
|
||||
|
@ -192,7 +192,7 @@ describe Projects::DeployKeysController do
|
|||
it 'redirects to login' do
|
||||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
expect(DeployKey.find(deploy_key.id)).to eq(deploy_key)
|
||||
end
|
||||
|
@ -206,7 +206,7 @@ describe Projects::DeployKeysController do
|
|||
it 'returns 404' do
|
||||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(DeployKey.find(deploy_key.id)).to eq(deploy_key)
|
||||
end
|
||||
end
|
||||
|
@ -215,7 +215,7 @@ describe Projects::DeployKeysController do
|
|||
it 'returns 302' do
|
||||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
|
||||
|
||||
expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
|
@ -224,7 +224,7 @@ describe Projects::DeployKeysController do
|
|||
it 'returns 404' do
|
||||
put :disable, params: { id: 0, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -238,7 +238,7 @@ describe Projects::DeployKeysController do
|
|||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.to change { DeployKey.count }.by(-1)
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
|
||||
|
||||
expect { DeployKey.find(deploy_key.id) }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
|
|
|
@ -61,7 +61,7 @@ describe Projects::DeploymentsController do
|
|||
|
||||
it 'returns a empty response 204 resposne' do
|
||||
get :metrics, params: deployment_params(id: deployment.to_param)
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response).to have_gitlab_http_status(:no_content)
|
||||
expect(response.body).to eq('')
|
||||
end
|
||||
end
|
||||
|
@ -100,7 +100,7 @@ describe Projects::DeploymentsController do
|
|||
|
||||
get :metrics, params: deployment_params(id: failed_deployment.to_param)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -129,7 +129,7 @@ describe Projects::DeploymentsController do
|
|||
|
||||
it 'returns a empty response 204 response' do
|
||||
get :additional_metrics, params: deployment_params(id: deployment.to_param, format: :json)
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response).to have_gitlab_http_status(:no_content)
|
||||
expect(response.body).to eq('')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ describe Projects::DiscussionsController do
|
|||
it 'returns 404' do
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe Projects::DiscussionsController do
|
|||
it 'returns status 200' do
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'returns status 404 if MR does not exists' do
|
||||
|
@ -47,7 +47,7 @@ describe Projects::DiscussionsController do
|
|||
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -60,7 +60,7 @@ describe Projects::DiscussionsController do
|
|||
it 'returns status 200' do
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -74,7 +74,7 @@ describe Projects::DiscussionsController do
|
|||
it "returns status 404" do
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -91,7 +91,7 @@ describe Projects::DiscussionsController do
|
|||
it "returns status 404" do
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,7 +120,7 @@ describe Projects::DiscussionsController do
|
|||
it "returns status 200" do
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it "renders discussion with serializer" do
|
||||
|
@ -157,7 +157,7 @@ describe Projects::DiscussionsController do
|
|||
it "returns status 404" do
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -174,7 +174,7 @@ describe Projects::DiscussionsController do
|
|||
it "returns status 404" do
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -188,7 +188,7 @@ describe Projects::DiscussionsController do
|
|||
it "returns status 200" do
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
context "when vue_mr_discussions cookie is present" do
|
||||
|
|
|
@ -179,7 +179,7 @@ describe Projects::EnvironmentsController do
|
|||
params[:id] = 12345
|
||||
get :show, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -197,7 +197,7 @@ describe Projects::EnvironmentsController do
|
|||
patch_params = environment_params.merge(environment: { external_url: 'https://git.gitlab.com' })
|
||||
patch :update, params: patch_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -208,7 +208,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
patch :stop, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -221,7 +221,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
patch :stop, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to eq(
|
||||
{ 'redirect_url' =>
|
||||
project_job_url(project, action) })
|
||||
|
@ -235,7 +235,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
patch :stop, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to eq(
|
||||
{ 'redirect_url' =>
|
||||
project_environment_url(project, environment) })
|
||||
|
@ -278,7 +278,7 @@ describe Projects::EnvironmentsController do
|
|||
it 'responds with a status code 200' do
|
||||
get :terminal, params: environment_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'loads the terminals for the environment' do
|
||||
|
@ -295,7 +295,7 @@ describe Projects::EnvironmentsController do
|
|||
it 'responds with a status code 404' do
|
||||
get :terminal, params: environment_params(id: 666)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -321,7 +321,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
get :terminal_websocket_authorize, params: environment_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
|
||||
expect(response.body).to eq('{"workhorse":"response"}')
|
||||
end
|
||||
|
@ -331,7 +331,7 @@ describe Projects::EnvironmentsController do
|
|||
it 'returns 404' do
|
||||
get :terminal_websocket_authorize, params: environment_params(id: 666)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -386,7 +386,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
get :metrics, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response).to have_gitlab_http_status(:no_content)
|
||||
expect(json_response).to eq({})
|
||||
end
|
||||
end
|
||||
|
@ -428,7 +428,7 @@ describe Projects::EnvironmentsController do
|
|||
it 'returns a metrics JSON document' do
|
||||
additional_metrics(window_params)
|
||||
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response).to have_gitlab_http_status(:no_content)
|
||||
expect(json_response).to eq({})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Projects::ForksController do
|
|||
it 'returns with 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -167,7 +167,7 @@ describe Projects::ForksController do
|
|||
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -205,7 +205,7 @@ describe Projects::ForksController do
|
|||
it 'responds with status 302' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(namespace_project_import_path(user.namespace, project))
|
||||
end
|
||||
|
||||
|
@ -228,7 +228,7 @@ describe Projects::ForksController do
|
|||
it 'passes continue params to the redirect' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response).to redirect_to(namespace_project_import_path(user.namespace, project, continue: continue_params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ describe Projects::GroupLinksController do
|
|||
include_context 'link project to group'
|
||||
|
||||
it 'responds with status 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ describe Projects::HooksController do
|
|||
|
||||
post :create, params: { namespace_id: project.namespace, project_id: project, hook: hook_params }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(ProjectHook.all.size).to eq(1)
|
||||
expect(ProjectHook.first).to have_attributes(hook_params)
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ describe Projects::IssuesController do
|
|||
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -32,7 +32,7 @@ describe Projects::IssuesController do
|
|||
it 'renders the "index" template' do
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template(:index)
|
||||
end
|
||||
end
|
||||
|
@ -51,14 +51,14 @@ describe Projects::IssuesController do
|
|||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to redirect_to(project_issues_path(new_project))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
|
||||
it 'redirects from an old issue correctly' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project, id: issue }
|
||||
|
||||
expect(response).to redirect_to(project_issue_path(new_project, issue))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ describe Projects::IssuesController do
|
|||
it "returns index" do
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it "returns 301 if request path doesn't match project path" do
|
||||
|
@ -92,7 +92,7 @@ describe Projects::IssuesController do
|
|||
project.save!
|
||||
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -118,7 +118,7 @@ describe Projects::IssuesController do
|
|||
|
||||
get :index, params: params.merge(page: last_page + 1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:issues).size).to eq(2)
|
||||
end
|
||||
end
|
||||
|
@ -227,7 +227,7 @@ describe Projects::IssuesController do
|
|||
|
||||
get :new, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -235,7 +235,7 @@ describe Projects::IssuesController do
|
|||
it 'renders the "new" template' do
|
||||
get :new, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template(:new)
|
||||
end
|
||||
end
|
||||
|
@ -330,7 +330,7 @@ describe Projects::IssuesController do
|
|||
|
||||
[issue1, issue2, issue3].map(&:reload)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(issue1.relative_position)
|
||||
.to be_between(issue2.relative_position, issue3.relative_position)
|
||||
end
|
||||
|
@ -340,7 +340,7 @@ describe Projects::IssuesController do
|
|||
it 'returns a unprocessable entity 422 response for invalid move ids' do
|
||||
reorder_issue(issue1, move_after_id: 99, move_before_id: 999)
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
end
|
||||
|
||||
it 'returns a not found 404 response for invalid issue id' do
|
||||
|
@ -348,7 +348,7 @@ describe Projects::IssuesController do
|
|||
move_after_id: issue2.id,
|
||||
move_before_id: issue3.id)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'returns a unprocessable entity 422 response for issues not in group' do
|
||||
|
@ -359,7 +359,7 @@ describe Projects::IssuesController do
|
|||
move_before_id: issue3.id,
|
||||
group_full_path: another_group.full_path)
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -415,7 +415,7 @@ describe Projects::IssuesController do
|
|||
it 'updates the issue' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(issue.reload.title).to eq('New title')
|
||||
end
|
||||
|
||||
|
@ -443,7 +443,7 @@ describe Projects::IssuesController do
|
|||
it 'updates the issue' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(issue.reload.title).to eq('New title')
|
||||
end
|
||||
end
|
||||
|
@ -458,7 +458,7 @@ describe Projects::IssuesController do
|
|||
it 'responds with 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(:not_found)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -505,7 +505,7 @@ describe Projects::IssuesController do
|
|||
it 'returns 200' do
|
||||
go(id: issue.iid)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -749,7 +749,7 @@ describe Projects::IssuesController do
|
|||
it 'returns 200 status' do
|
||||
update_issue
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -769,7 +769,7 @@ describe Projects::IssuesController do
|
|||
it 'returns 200 status' do
|
||||
update_issue
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -785,7 +785,7 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
it 'returns 200 status' do
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'accepts an issue after recaptcha is verified' do
|
||||
|
@ -1131,7 +1131,7 @@ describe Projects::IssuesController do
|
|||
|
||||
it "rejects a developer to destroy an issue" do
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1147,14 +1147,14 @@ describe Projects::IssuesController do
|
|||
it "deletes the issue" do
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, destroy_confirm: true }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./)
|
||||
end
|
||||
|
||||
it "deletes the issue" do
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, destroy_confirm: true }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./)
|
||||
end
|
||||
|
||||
|
@ -1163,7 +1163,7 @@ describe Projects::IssuesController do
|
|||
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(controller).to set_flash[:notice].to('Destroy confirmation not provided for issue')
|
||||
end
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ describe Projects::IssuesController do
|
|||
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid, format: 'json' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
expect(json_response).to eq({ 'errors' => 'Destroy confirmation not provided for issue' })
|
||||
end
|
||||
|
||||
|
@ -1206,7 +1206,7 @@ describe Projects::IssuesController do
|
|||
subject
|
||||
end.to change { issue.award_emoji.count }.by(1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it "removes the already awarded emoji" do
|
||||
|
@ -1214,7 +1214,7 @@ describe Projects::IssuesController do
|
|||
|
||||
expect { subject }.to change { AwardEmoji.count }.by(-1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'marks Todos on the Issue as done' do
|
||||
|
@ -1250,7 +1250,7 @@ describe Projects::IssuesController do
|
|||
|
||||
create_merge_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'is not available for users who cannot create merge requests' do
|
||||
|
@ -1258,7 +1258,7 @@ describe Projects::IssuesController do
|
|||
|
||||
create_merge_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
context 'target_project_id is set' do
|
||||
|
|
|
@ -1183,7 +1183,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
|
||||
get_terminal_websocket(id: job.id)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
|
||||
expect(response.body).to eq('{"workhorse":"response"}')
|
||||
end
|
||||
|
@ -1193,7 +1193,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
it 'returns 404' do
|
||||
get_terminal_websocket(id: 1234)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,7 +80,7 @@ describe Projects::LabelsController do
|
|||
it 'creates labels' do
|
||||
post :generate, params: { namespace_id: personal_project.namespace.to_param, project_id: personal_project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -88,7 +88,7 @@ describe Projects::LabelsController do
|
|||
it 'creates labels' do
|
||||
post :generate, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -99,7 +99,7 @@ describe Projects::LabelsController do
|
|||
|
||||
toggle_subscription(label)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'allows user to toggle subscription on group labels' do
|
||||
|
@ -107,7 +107,7 @@ describe Projects::LabelsController do
|
|||
|
||||
toggle_subscription(group_label)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
def toggle_subscription(label)
|
||||
|
@ -123,7 +123,7 @@ describe Projects::LabelsController do
|
|||
it 'denies access' do
|
||||
post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -180,7 +180,7 @@ describe Projects::LabelsController do
|
|||
it 'does not redirect' do
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project.to_param }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
expect(response).not_to have_gitlab_http_status(:moved_permanently)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -231,13 +231,13 @@ describe Projects::LabelsController do
|
|||
it 'does not 404' do
|
||||
post :generate, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
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 :generate, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
expect(response).not_to have_gitlab_http_status(:moved_permanently)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -247,7 +247,7 @@ describe Projects::LabelsController do
|
|||
it 'returns not found' do
|
||||
post :generate, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ describe Projects::MattermostsController do
|
|||
project_id: project
|
||||
})
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ describe Projects::MergeRequestsController do
|
|||
}
|
||||
|
||||
expect(response).to redirect_to(project_merge_request_path(new_project, merge_request))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
|
||||
it 'redirects from an old merge request commits correctly' do
|
||||
|
@ -125,7 +125,7 @@ describe Projects::MergeRequestsController do
|
|||
}
|
||||
|
||||
expect(response).to redirect_to(commits_project_merge_request_path(new_project, merge_request))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -229,7 +229,7 @@ describe Projects::MergeRequestsController do
|
|||
get_merge_requests(last_page)
|
||||
|
||||
expect(assigns(:merge_requests).current_page).to eq(last_page)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'does not redirect to external sites when provided a host field' do
|
||||
|
@ -306,7 +306,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'responds with 404' do
|
||||
update_merge_request(title: 'New title')
|
||||
|
||||
expect(response).to have_http_status(:not_found)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -381,7 +381,7 @@ describe Projects::MergeRequestsController do
|
|||
end
|
||||
|
||||
it 'returns 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -615,7 +615,7 @@ describe Projects::MergeRequestsController do
|
|||
it "denies access to users unless they're admin or project owner" do
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
context "when the user is owner" do
|
||||
|
@ -630,7 +630,7 @@ describe Projects::MergeRequestsController do
|
|||
it "deletes the merge request" do
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid, destroy_confirm: true }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./)
|
||||
end
|
||||
|
||||
|
@ -639,7 +639,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(controller).to set_flash[:notice].to('Destroy confirmation not provided for merge request')
|
||||
end
|
||||
|
||||
|
@ -648,7 +648,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid, format: 'json' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
expect(json_response).to eq({ 'errors' => 'Destroy confirmation not provided for merge request' })
|
||||
end
|
||||
|
||||
|
@ -842,7 +842,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'responds with a 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.body).to be_blank
|
||||
end
|
||||
end
|
||||
|
@ -855,7 +855,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'responds with a 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.body).to be_blank
|
||||
end
|
||||
end
|
||||
|
@ -898,7 +898,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'returns exposed artifacts' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['status']).to eq('parsed')
|
||||
expect(json_response['data']).to eq([{
|
||||
'job_name' => 'test',
|
||||
|
@ -951,7 +951,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'returns no content' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response).to have_gitlab_http_status(:no_content)
|
||||
expect(response.body).to be_empty
|
||||
end
|
||||
end
|
||||
|
@ -998,7 +998,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'responds with a 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.body).to be_blank
|
||||
end
|
||||
end
|
||||
|
@ -1011,7 +1011,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'responds with a 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.body).to be_blank
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,14 +30,14 @@ describe Projects::MilestonesController do
|
|||
it 'shows milestone page' do
|
||||
view_milestone
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.content_type).to eq 'text/html'
|
||||
end
|
||||
|
||||
it 'returns milestone json' do
|
||||
view_milestone format: :json
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
end
|
||||
end
|
||||
|
@ -171,7 +171,7 @@ describe Projects::MilestonesController do
|
|||
it 'renders 404' do
|
||||
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -190,7 +190,7 @@ describe Projects::MilestonesController do
|
|||
|
||||
get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
|
||||
expect(json_response['html']).not_to include(label.title)
|
||||
|
@ -201,7 +201,7 @@ describe Projects::MilestonesController do
|
|||
|
||||
get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
|
||||
expect(json_response['html']).to include(label.title)
|
||||
|
@ -240,7 +240,7 @@ describe Projects::MilestonesController do
|
|||
|
||||
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -263,7 +263,7 @@ describe Projects::MilestonesController do
|
|||
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json }
|
||||
get :participants, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
expect(json_response['html']).to include(issue_assignee.name)
|
||||
end
|
||||
|
@ -278,7 +278,7 @@ describe Projects::MilestonesController do
|
|||
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :json }
|
||||
get :participants, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
expect(json_response['html']).not_to include(issue_assignee.name)
|
||||
end
|
||||
|
|
|
@ -103,7 +103,7 @@ describe Projects::MirrorsController do
|
|||
it "returns an error with a 400 response for URL #{url.inspect}" do
|
||||
do_get(project, url)
|
||||
|
||||
expect(response).to have_gitlab_http_status(400)
|
||||
expect(response).to have_gitlab_http_status(:bad_request)
|
||||
expect(json_response).to eq('message' => 'Invalid URL')
|
||||
end
|
||||
end
|
||||
|
@ -115,7 +115,7 @@ describe Projects::MirrorsController do
|
|||
|
||||
do_get(project)
|
||||
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response).to have_gitlab_http_status(:no_content)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -125,7 +125,7 @@ describe Projects::MirrorsController do
|
|||
|
||||
do_get(project)
|
||||
|
||||
expect(response).to have_gitlab_http_status(400)
|
||||
expect(response).to have_gitlab_http_status(:bad_request)
|
||||
expect(json_response).to eq('message' => 'An error')
|
||||
end
|
||||
end
|
||||
|
@ -139,7 +139,7 @@ describe Projects::MirrorsController do
|
|||
|
||||
do_get(project)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to eq('known_hosts' => ssh_key, 'fingerprints' => [ssh_fp.stringify_keys], 'host_keys_changed' => true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -152,7 +152,7 @@ describe Projects::NotesController do
|
|||
it 'renders 404' do
|
||||
get :index, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -246,7 +246,7 @@ describe Projects::NotesController do
|
|||
context 'the project is publically available' do
|
||||
context 'for HTML' do
|
||||
it "returns status 302" do
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -254,7 +254,7 @@ describe Projects::NotesController do
|
|||
let(:extra_request_params) { { format: :json } }
|
||||
|
||||
it "returns status 200 for json" do
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -265,7 +265,7 @@ describe Projects::NotesController do
|
|||
let(:extra_request_params) { { format: :json } }
|
||||
|
||||
it "returns status 422 for json" do
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -278,7 +278,7 @@ describe Projects::NotesController do
|
|||
let(:extra_request_params) { extra }
|
||||
|
||||
it "returns status 404" do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -296,7 +296,7 @@ describe Projects::NotesController do
|
|||
it "returns status 302 (redirect)" do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -306,7 +306,7 @@ describe Projects::NotesController do
|
|||
it "returns status 200" do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -316,7 +316,7 @@ describe Projects::NotesController do
|
|||
it 'returns discussion JSON when the return_discussion param is set' do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to have_key 'discussion'
|
||||
expect(json_response.dig('discussion', 'notes', 0, 'note')).to eq(request_params[:note][:note])
|
||||
end
|
||||
|
@ -330,7 +330,7 @@ describe Projects::NotesController do
|
|||
it 'includes changes in commands_changes ' do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['commands_changes']).to include('emoji_award', 'time_estimate', 'spend_time')
|
||||
expect(json_response['commands_changes']).not_to include('target_project', 'title')
|
||||
end
|
||||
|
@ -349,7 +349,7 @@ describe Projects::NotesController do
|
|||
it 'does not include changes in commands_changes' do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['commands_changes']).not_to include('target_project', 'title')
|
||||
end
|
||||
end
|
||||
|
@ -363,7 +363,7 @@ describe Projects::NotesController do
|
|||
it "prevents a non-member user from creating a note on one of the project's merge requests" do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
context 'when the user is a team member' do
|
||||
|
@ -424,7 +424,7 @@ describe Projects::NotesController do
|
|||
|
||||
it 'returns an error to the user' do
|
||||
create!
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -436,7 +436,7 @@ describe Projects::NotesController do
|
|||
it "prevents a non-member user from creating a note on one of the project's merge requests" do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
context 'when the user is a team member' do
|
||||
|
@ -467,7 +467,7 @@ describe Projects::NotesController do
|
|||
it "returns status 302 for html" do
|
||||
create!
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -531,7 +531,7 @@ describe Projects::NotesController do
|
|||
|
||||
it 'returns a 404', :sidekiq_might_not_need_inline do
|
||||
create!
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -540,7 +540,7 @@ describe Projects::NotesController do
|
|||
|
||||
it 'returns a 404', :sidekiq_might_not_need_inline do
|
||||
create!
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -550,7 +550,7 @@ describe Projects::NotesController do
|
|||
|
||||
it 'is successful' do
|
||||
create!
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
|
||||
it 'creates the note' do
|
||||
|
@ -574,7 +574,7 @@ describe Projects::NotesController do
|
|||
|
||||
expect { post :create, params: request_params }.to change { issue.notes.count }.by(1)
|
||||
.and change { locked_issue.notes.count }.by(0)
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -588,7 +588,7 @@ describe Projects::NotesController do
|
|||
request_params[:target_id] = 9999
|
||||
post :create, params: request_params.merge(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -600,13 +600,13 @@ describe Projects::NotesController do
|
|||
it 'returns 302 status for html' do
|
||||
post :create, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
|
||||
it 'returns 200 status for json' do
|
||||
post :create, params: request_params.merge(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'creates a new note' do
|
||||
|
@ -618,7 +618,7 @@ describe Projects::NotesController do
|
|||
it 'returns 404 status' do
|
||||
post :create, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'does not create a new note' do
|
||||
|
@ -671,7 +671,7 @@ describe Projects::NotesController do
|
|||
}
|
||||
}
|
||||
expect { put :update, params: request_params }.not_to change { note.reload.note }
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -695,7 +695,7 @@ describe Projects::NotesController do
|
|||
it "returns status 200 for html" do
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it "deletes the note" do
|
||||
|
@ -712,7 +712,7 @@ describe Projects::NotesController do
|
|||
it "returns status 404" do
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -732,7 +732,7 @@ describe Projects::NotesController do
|
|||
subject
|
||||
end.to change { note.award_emoji.count }.by(1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it "removes the already awarded emoji" do
|
||||
|
@ -740,7 +740,7 @@ describe Projects::NotesController do
|
|||
|
||||
expect { subject }.to change { AwardEmoji.count }.by(-1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'marks Todos on the Noteable as done' do
|
||||
|
@ -766,7 +766,7 @@ describe Projects::NotesController do
|
|||
it "returns status 404" do
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -783,7 +783,7 @@ describe Projects::NotesController do
|
|||
it "returns status 404" do
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -812,7 +812,7 @@ describe Projects::NotesController do
|
|||
it "returns status 200" do
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -829,7 +829,7 @@ describe Projects::NotesController do
|
|||
it "returns status 404" do
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -846,7 +846,7 @@ describe Projects::NotesController do
|
|||
it "returns status 404" do
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -860,7 +860,7 @@ describe Projects::NotesController do
|
|||
it "returns status 200" do
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Projects::PagesController do
|
|||
it 'returns 200 status' do
|
||||
get :show, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
context 'when the project is in a subgroup' do
|
||||
|
@ -33,7 +33,7 @@ describe Projects::PagesController do
|
|||
it 'returns a 200 status code' do
|
||||
get :show, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -42,7 +42,7 @@ describe Projects::PagesController do
|
|||
it 'returns 302 status' do
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
|
||||
context 'when user is developer' do
|
||||
|
@ -53,7 +53,7 @@ describe Projects::PagesController do
|
|||
it 'returns 404 status' do
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ describe Projects::PagesController do
|
|||
it 'returns 404 status' do
|
||||
get :show, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -75,7 +75,7 @@ describe Projects::PagesController do
|
|||
it 'returns 404 status' do
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ describe Projects::PagesDomainsController do
|
|||
it "displays to the 'show' page" do
|
||||
make_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('show')
|
||||
end
|
||||
|
||||
|
@ -47,7 +47,7 @@ describe Projects::PagesDomainsController do
|
|||
it 'renders 404 page' do
|
||||
make_request
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -56,7 +56,7 @@ describe Projects::PagesDomainsController do
|
|||
it "displays the 'new' page" do
|
||||
get(:new, params: request_params)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('new')
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ describe Projects::PagesDomainsController do
|
|||
it "displays the 'show' page" do
|
||||
get(:show, params: request_params.merge(id: pages_domain.domain))
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('show')
|
||||
end
|
||||
end
|
||||
|
@ -177,7 +177,7 @@ describe Projects::PagesDomainsController do
|
|||
it 'returns a 404 response for an unknown domain' do
|
||||
post :verify, params: request_params.merge(id: 'unknown-domain')
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -250,7 +250,7 @@ describe Projects::PagesDomainsController do
|
|||
it 'returns 404 status' do
|
||||
get(:show, params: request_params.merge(id: pages_domain.domain))
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -258,7 +258,7 @@ describe Projects::PagesDomainsController do
|
|||
it 'returns 404 status' do
|
||||
get :new, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -266,7 +266,7 @@ describe Projects::PagesDomainsController do
|
|||
it "returns 404 status" do
|
||||
post(:create, params: request_params.merge(pages_domain: pages_domain_params))
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -274,7 +274,7 @@ describe Projects::PagesDomainsController do
|
|||
it "deletes the pages domain" do
|
||||
delete(:destroy, params: request_params.merge(id: pages_domain.domain))
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -396,7 +396,7 @@ describe Projects::PipelineSchedulesController do
|
|||
|
||||
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -407,7 +407,7 @@ describe Projects::PipelineSchedulesController do
|
|||
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
|
||||
expect(flash[:notice]).to start_with 'Successfully scheduled a pipeline to run'
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
|
||||
it 'prevents users from scheduling the same pipeline repeatedly' do
|
||||
|
@ -417,7 +417,7 @@ describe Projects::PipelineSchedulesController do
|
|||
|
||||
expect(flash.to_a.size).to eq(2)
|
||||
expect(flash[:alert]).to eq _('You cannot play this scheduled pipeline at the moment. Please wait a minute.')
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -430,7 +430,7 @@ describe Projects::PipelineSchedulesController do
|
|||
|
||||
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: protected_schedule.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -460,7 +460,7 @@ describe Projects::PipelineSchedulesController do
|
|||
delete :destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
end.to change { project.pipeline_schedules.count }.by(-1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -703,7 +703,7 @@ describe Projects::PipelinesController do
|
|||
it 'shows latest pipeline for the default project branch' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: nil }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:pipeline)).to have_attributes(id: pipeline_master.id)
|
||||
end
|
||||
end
|
||||
|
@ -716,7 +716,7 @@ describe Projects::PipelinesController do
|
|||
it 'shows the latest pipeline for the provided ref' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: branch_secondary.name }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:pipeline)).to have_attributes(id: pipeline_secondary.id)
|
||||
end
|
||||
|
||||
|
@ -728,7 +728,7 @@ describe Projects::PipelinesController do
|
|||
it 'shows the provided ref with the last sha/pipeline combo' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: branch_secondary.name }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:pipeline)).to have_attributes(id: pipeline_secondary.id)
|
||||
end
|
||||
end
|
||||
|
@ -737,7 +737,7 @@ describe Projects::PipelinesController do
|
|||
it 'renders a 404 if no pipeline is found for the ref' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project, ref: 'no-branch' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -754,7 +754,7 @@ describe Projects::PipelinesController do
|
|||
it 'deletes pipeline and redirects' do
|
||||
delete_pipeline
|
||||
|
||||
expect(response).to have_gitlab_http_status(303)
|
||||
expect(response).to have_gitlab_http_status(:see_other)
|
||||
|
||||
expect(Ci::Build.exists?(build.id)).to be_falsy
|
||||
expect(Ci::Pipeline.exists?(pipeline.id)).to be_falsy
|
||||
|
@ -766,7 +766,7 @@ describe Projects::PipelinesController do
|
|||
it 'fails to delete pipeline' do
|
||||
delete_pipeline
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -775,7 +775,7 @@ describe Projects::PipelinesController do
|
|||
it 'fails to delete pipeline' do
|
||||
delete_pipeline
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe Projects::PipelinesSettingsController do
|
|||
it 'redirects with 302 status code' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ describe Projects::ProjectMembersController do
|
|||
it 'has the project_members address with a 200 status code' do
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
context 'when project belongs to group' do
|
||||
|
@ -64,7 +64,7 @@ describe Projects::ProjectMembersController do
|
|||
access_level: Gitlab::Access::GUEST
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(project.users).not_to include project_user
|
||||
end
|
||||
end
|
||||
|
@ -145,7 +145,7 @@ describe Projects::ProjectMembersController do
|
|||
id: 42
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -162,7 +162,7 @@ describe Projects::ProjectMembersController do
|
|||
id: member
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(project.members).to include member
|
||||
end
|
||||
end
|
||||
|
@ -211,7 +211,7 @@ describe Projects::ProjectMembersController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -246,7 +246,7 @@ describe Projects::ProjectMembersController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -305,7 +305,7 @@ describe Projects::ProjectMembersController do
|
|||
id: 42
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -322,7 +322,7 @@ describe Projects::ProjectMembersController do
|
|||
id: member
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
expect(project.members).not_to include member
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Projects::RawController do
|
|||
it 'delivers ASCII file' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.header['Content-Type']).to eq('text/plain; charset=utf-8')
|
||||
expect(response.header['Content-Disposition']).to eq('inline')
|
||||
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
|
||||
|
@ -37,7 +37,7 @@ describe Projects::RawController do
|
|||
it 'leaves image content disposition' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.header['Content-Disposition']).to eq('inline')
|
||||
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
|
||||
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
|
||||
|
@ -63,7 +63,7 @@ describe Projects::RawController do
|
|||
.to change { Gitlab::GitalyClient.get_request_count }.by(0)
|
||||
|
||||
expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
|
||||
expect(response).to have_gitlab_http_status(429)
|
||||
expect(response).to have_gitlab_http_status(:too_many_requests)
|
||||
end
|
||||
|
||||
it 'logs the event on auth.log' do
|
||||
|
@ -94,7 +94,7 @@ describe Projects::RawController do
|
|||
request.headers['X-Gitlab-External-Storage-Token'] = token
|
||||
execute_raw_requests(requests: 6, project: project, file_path: file_path)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -113,7 +113,7 @@ describe Projects::RawController do
|
|||
execute_raw_requests(requests: 3, project: project, file_path: modified_path)
|
||||
|
||||
expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
|
||||
expect(response).to have_gitlab_http_status(429)
|
||||
expect(response).to have_gitlab_http_status(:too_many_requests)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -125,7 +125,7 @@ describe Projects::RawController do
|
|||
it 'does not prevent from accessing the raw file' do
|
||||
execute_raw_requests(requests: 10, project: project, file_path: file_path)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -141,14 +141,14 @@ describe Projects::RawController do
|
|||
execute_raw_requests(requests: 6, project: project, file_path: file_path)
|
||||
|
||||
expect(response.body).to eq(_('You cannot access the raw file. Please wait a minute.'))
|
||||
expect(response).to have_gitlab_http_status(429)
|
||||
expect(response).to have_gitlab_http_status(:too_many_requests)
|
||||
|
||||
# Accessing upcase version of readme
|
||||
file_path = "#{commit_sha}/README.md"
|
||||
|
||||
execute_raw_requests(requests: 1, project: project, file_path: file_path)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -166,7 +166,7 @@ describe Projects::RawController do
|
|||
it 'redirects to sign in page' do
|
||||
execute_raw_requests(requests: 1, project: project, file_path: file_path)
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response.location).to end_with('/users/sign_in')
|
||||
end
|
||||
end
|
||||
|
@ -176,7 +176,7 @@ describe Projects::RawController do
|
|||
it 'calls the action normally' do
|
||||
execute_raw_requests(requests: 1, project: project, file_path: file_path, token: user.static_object_token)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -184,7 +184,7 @@ describe Projects::RawController do
|
|||
it 'redirects to sign in page' do
|
||||
execute_raw_requests(requests: 1, project: project, file_path: file_path, token: 'foobar')
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response.location).to end_with('/users/sign_in')
|
||||
end
|
||||
end
|
||||
|
@ -196,7 +196,7 @@ describe Projects::RawController do
|
|||
request.headers['X-Gitlab-Static-Object-Token'] = user.static_object_token
|
||||
execute_raw_requests(requests: 1, project: project, file_path: file_path)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -205,7 +205,7 @@ describe Projects::RawController do
|
|||
request.headers['X-Gitlab-Static-Object-Token'] = 'foobar'
|
||||
execute_raw_requests(requests: 1, project: project, file_path: file_path)
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(response.location).to end_with('/users/sign_in')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@ describe Projects::RepositoriesController do
|
|||
it 'handles legacy queries with the ref specified as ref in params' do
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, ref: 'feature' }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:ref)).to eq('feature')
|
||||
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
|
||||
end
|
||||
|
@ -53,7 +53,7 @@ describe Projects::RepositoriesController do
|
|||
it 'handles legacy queries with the ref specified as id in params' do
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature' }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:ref)).to eq('feature')
|
||||
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ describe Projects::RepositoriesController do
|
|||
it 'prioritizes the id param over the ref param when both are specified' do
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature', ref: 'feature_conflict' }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:ref)).to eq('feature')
|
||||
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
|
||||
end
|
||||
|
@ -74,7 +74,7 @@ describe Projects::RepositoriesController do
|
|||
it "renders Not Found" do
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master" }, format: "zip"
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -82,7 +82,7 @@ describe Projects::RepositoriesController do
|
|||
it 'sets appropriate caching headers' do
|
||||
get_archive
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.header['ETag']).to be_present
|
||||
expect(response.header['Cache-Control']).to include('max-age=60, private')
|
||||
end
|
||||
|
@ -93,7 +93,7 @@ describe Projects::RepositoriesController do
|
|||
it 'sets appropriate caching headers' do
|
||||
get_archive
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.header['ETag']).to be_present
|
||||
expect(response.header['Cache-Control']).to include('max-age=60, public')
|
||||
end
|
||||
|
@ -103,7 +103,7 @@ describe Projects::RepositoriesController do
|
|||
it 'max-age is set to 3600 in Cache-Control header' do
|
||||
get_archive('ddd0f15ae83993f5cb66a927a28673882e99100b')
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.header['Cache-Control']).to include('max-age=3600')
|
||||
end
|
||||
end
|
||||
|
@ -116,7 +116,7 @@ describe Projects::RepositoriesController do
|
|||
request.headers['If-None-Match'] = response.headers['ETag']
|
||||
get_archive
|
||||
|
||||
expect(response).to have_gitlab_http_status(304)
|
||||
expect(response).to have_gitlab_http_status(:not_modified)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -137,7 +137,7 @@ describe Projects::RepositoriesController do
|
|||
it 'redirects to sign in page' do
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -146,7 +146,7 @@ describe Projects::RepositoriesController do
|
|||
it 'calls the action normally' do
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: user.static_object_token }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -154,7 +154,7 @@ describe Projects::RepositoriesController do
|
|||
it 'redirects to sign in page' do
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master', token: 'foobar' }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -165,7 +165,7 @@ describe Projects::RepositoriesController do
|
|||
request.headers['X-Gitlab-Static-Object-Token'] = user.static_object_token
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -174,7 +174,7 @@ describe Projects::RepositoriesController do
|
|||
request.headers['X-Gitlab-Static-Object-Token'] = 'foobar'
|
||||
get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: 'zip'
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ describe Projects::RunnersController do
|
|||
|
||||
runner.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(runner.description).to eq(new_desc)
|
||||
end
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ describe Projects::RunnersController do
|
|||
it 'destroys the runner' do
|
||||
delete :destroy, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(Ci::Runner.find_by(id: runner.id)).to be_nil
|
||||
end
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ describe Projects::RunnersController do
|
|||
|
||||
runner.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(runner.active).to eq(true)
|
||||
end
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ describe Projects::RunnersController do
|
|||
|
||||
runner.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(runner.active).to eq(false)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ describe Projects::SnippetsController do
|
|||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(assigns(:snippets)).not_to include(project_snippet)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ describe Projects::SnippetsController do
|
|||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(assigns(:snippets)).to include(project_snippet)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -61,7 +61,7 @@ describe Projects::SnippetsController do
|
|||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(assigns(:snippets)).to include(project_snippet)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -318,7 +318,7 @@ describe Projects::SnippetsController do
|
|||
it 'responds with status 404' do
|
||||
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -331,7 +331,7 @@ describe Projects::SnippetsController do
|
|||
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
|
||||
|
||||
expect(assigns(:snippet)).to eq(project_snippet)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -344,7 +344,7 @@ describe Projects::SnippetsController do
|
|||
get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
|
||||
|
||||
expect(assigns(:snippet)).to eq(project_snippet)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -354,7 +354,7 @@ describe Projects::SnippetsController do
|
|||
it 'responds with status 404' do
|
||||
get action, params: { namespace_id: project.namespace, project_id: project, id: 42 }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -366,7 +366,7 @@ describe Projects::SnippetsController do
|
|||
it 'responds with status 404' do
|
||||
get action, params: { namespace_id: project.namespace, project_id: project, id: 42 }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -386,7 +386,7 @@ describe Projects::SnippetsController do
|
|||
let(:snippet_permission) { :private }
|
||||
|
||||
it 'responds with status 404' do
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -395,7 +395,7 @@ describe Projects::SnippetsController do
|
|||
|
||||
it 'responds with status 200' do
|
||||
expect(assigns(:snippet)).to eq(project_snippet)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -407,7 +407,7 @@ describe Projects::SnippetsController do
|
|||
|
||||
it 'responds with status 404' do
|
||||
expect(assigns(:snippet)).to eq(project_snippet)
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -501,7 +501,7 @@ describe Projects::SnippetsController do
|
|||
it 'responds with status 404' do
|
||||
delete :destroy, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ describe Projects::StagesController do
|
|||
it 'returns not authorized' do
|
||||
play_manual_stage!
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ describe Projects::TemplatesController do
|
|||
it 'returns the template names' do
|
||||
get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response.size).to eq(1)
|
||||
expect(json_response[0]['name']).to eq(expected_template_name)
|
||||
end
|
||||
|
@ -121,7 +121,7 @@ describe Projects::TemplatesController do
|
|||
|
||||
get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Projects::TodosController do
|
|||
|
||||
it "doesn't create todo" do
|
||||
expect { post_create }.not_to change { user.todos.count }
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -85,7 +85,7 @@ describe Projects::TreeController do
|
|||
context "valid SHA commit ID with path" do
|
||||
let(:id) { '6d39438/.gitignore' }
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(302) }
|
||||
it { expect(response).to have_gitlab_http_status(:found) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ describe Projects::UploadsController do
|
|||
it "responds with status internal_server_error" do
|
||||
post_authorize
|
||||
|
||||
expect(response).to have_gitlab_http_status(500)
|
||||
expect(response).to have_gitlab_http_status(:internal_server_error)
|
||||
expect(response.body).to eq(_('Error uploading file'))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ describe Projects::UsagePingController do
|
|||
it 'returns 302' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -32,7 +32,7 @@ describe Projects::UsagePingController do
|
|||
it 'returns 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -57,7 +57,7 @@ describe Projects::UsagePingController do
|
|||
it 'returns 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ describe Projects::WikisController do
|
|||
it 'redirects to #show and appends a `random_title` param' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(Rails.application.routes.recognize_path(response.redirect_url)).to include(
|
||||
controller: 'projects/wikis',
|
||||
action: 'show'
|
||||
|
@ -70,7 +70,7 @@ describe Projects::WikisController do
|
|||
end
|
||||
|
||||
it "returns status #{expected_status}" do
|
||||
expect(response).to have_http_status(expected_status)
|
||||
expect(response).to have_gitlab_http_status(expected_status)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -103,7 +103,7 @@ describe Projects::WikisController do
|
|||
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:page).title).to eq(wiki_title)
|
||||
end
|
||||
|
||||
|
@ -113,7 +113,7 @@ describe Projects::WikisController do
|
|||
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(flash[:notice]).to eq(_('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.'))
|
||||
end
|
||||
end
|
||||
|
@ -204,7 +204,7 @@ describe Projects::WikisController do
|
|||
it 'shows the edit page' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.body).to include(s_('Wiki|Edit Page'))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,6 +30,16 @@ describe SentNotificationsController do
|
|||
let(:target_project) { project }
|
||||
|
||||
describe 'GET unsubscribe' do
|
||||
shared_examples 'returns 404' do
|
||||
it 'does not set the flash message' do
|
||||
expect(controller).not_to set_flash[:notice]
|
||||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the user is not logged in' do
|
||||
context 'when the force param is passed' do
|
||||
before do
|
||||
|
@ -156,6 +166,16 @@ describe SentNotificationsController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the noteable associated to the notification has been deleted' do
|
||||
before do
|
||||
sent_notification.noteable.destroy!
|
||||
|
||||
get(:unsubscribe, params: { id: sent_notification.reply_key })
|
||||
end
|
||||
|
||||
it_behaves_like 'returns 404'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the user is logged in' do
|
||||
|
@ -168,17 +188,7 @@ describe SentNotificationsController do
|
|||
get(:unsubscribe, params: { id: sent_notification.reply_key.reverse })
|
||||
end
|
||||
|
||||
it 'does not unsubscribe the user' do
|
||||
expect(issue.subscribed?(user, project)).to be_truthy
|
||||
end
|
||||
|
||||
it 'does not set the flash message' do
|
||||
expect(controller).not_to set_flash[:notice]
|
||||
end
|
||||
|
||||
it 'returns a 404' do
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
it_behaves_like 'returns 404'
|
||||
end
|
||||
|
||||
context 'when the force param is passed' do
|
||||
|
@ -254,6 +264,16 @@ describe SentNotificationsController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the noteable associated to the notification has been deleted' do
|
||||
before do
|
||||
sent_notification.noteable.destroy!
|
||||
|
||||
get(:unsubscribe, params: { id: sent_notification.reply_key })
|
||||
end
|
||||
|
||||
it_behaves_like 'returns 404'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,6 +44,17 @@ describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js do
|
|||
expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: ending_fragment)))
|
||||
end
|
||||
|
||||
it 'changes fragment hash if icon inside line number link is clicked' do
|
||||
ending_fragment = "L7"
|
||||
|
||||
visit_blob
|
||||
|
||||
find("##{ending_fragment}").hover
|
||||
find("##{ending_fragment} i").click
|
||||
|
||||
expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: ending_fragment)))
|
||||
end
|
||||
|
||||
it 'with initial fragment hash, changes fragment hash if line number clicked' do
|
||||
fragment = "L1"
|
||||
ending_fragment = "L5"
|
||||
|
@ -83,6 +94,17 @@ describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js do
|
|||
expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: ending_fragment)))
|
||||
end
|
||||
|
||||
it 'changes fragment hash if icon inside line number link is clicked' do
|
||||
ending_fragment = "L7"
|
||||
|
||||
visit_blob
|
||||
|
||||
find("##{ending_fragment}").hover
|
||||
find("##{ending_fragment} i").click
|
||||
|
||||
expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: ending_fragment)))
|
||||
end
|
||||
|
||||
it 'with initial fragment hash, changes fragment hash if line number clicked' do
|
||||
fragment = "L1"
|
||||
ending_fragment = "L5"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Vue from 'vue';
|
||||
import mountCompontent from 'helpers/vue_mount_component_helper';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import router from '~/ide/ide_router';
|
||||
import Item from '~/ide/components/branches/item.vue';
|
||||
import { getTimeago } from '~/lib/utils/datetime_utility';
|
||||
import Icon from '~/vue_shared/components/icon.vue';
|
||||
import Timeago from '~/vue_shared/components/time_ago_tooltip.vue';
|
||||
import { projectData } from '../../mock_data';
|
||||
|
||||
const TEST_BRANCH = {
|
||||
|
@ -12,45 +12,45 @@ const TEST_BRANCH = {
|
|||
const TEST_PROJECT_ID = projectData.name_with_namespace;
|
||||
|
||||
describe('IDE branch item', () => {
|
||||
const Component = Vue.extend(Item);
|
||||
let vm;
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
vm = mountCompontent(Component, {
|
||||
item: { ...TEST_BRANCH },
|
||||
projectId: TEST_PROJECT_ID,
|
||||
isActive: false,
|
||||
function createComponent(props = {}) {
|
||||
wrapper = shallowMount(Item, {
|
||||
propsData: {
|
||||
item: { ...TEST_BRANCH },
|
||||
projectId: TEST_PROJECT_ID,
|
||||
isActive: false,
|
||||
...props,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
describe('if not active', () => {
|
||||
beforeEach(() => {
|
||||
createComponent();
|
||||
});
|
||||
it('renders branch name and timeago', () => {
|
||||
expect(wrapper.text()).toContain(TEST_BRANCH.name);
|
||||
expect(wrapper.find(Timeago).props('time')).toBe(TEST_BRANCH.committedDate);
|
||||
expect(wrapper.find(Icon).exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('renders link to branch', () => {
|
||||
const expectedHref = router.resolve(`/project/${TEST_PROJECT_ID}/edit/${TEST_BRANCH.name}`)
|
||||
.href;
|
||||
|
||||
expect(wrapper.text()).toMatch('a');
|
||||
expect(wrapper.attributes('href')).toBe(expectedHref);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vm.$destroy();
|
||||
});
|
||||
it('renders icon if is not active', () => {
|
||||
createComponent({ isActive: true });
|
||||
|
||||
it('renders branch name and timeago', () => {
|
||||
const timeText = getTimeago().format(TEST_BRANCH.committedDate);
|
||||
|
||||
expect(vm.$el.textContent).toContain(TEST_BRANCH.name);
|
||||
expect(vm.$el.querySelector('time')).toHaveText(timeText);
|
||||
expect(vm.$el.querySelector('.ic-mobile-issue-close')).toBe(null);
|
||||
});
|
||||
|
||||
it('renders link to branch', () => {
|
||||
const expectedHref = router.resolve(`/project/${TEST_PROJECT_ID}/edit/${TEST_BRANCH.name}`)
|
||||
.href;
|
||||
|
||||
expect(vm.$el.textContent).toMatch('a');
|
||||
expect(vm.$el).toHaveAttr('href', expectedHref);
|
||||
});
|
||||
|
||||
it('renders icon if isActive', done => {
|
||||
vm.isActive = true;
|
||||
|
||||
vm.$nextTick()
|
||||
.then(() => {
|
||||
expect(vm.$el.querySelector('.ic-mobile-issue-close')).not.toBe(null);
|
||||
})
|
||||
.then(done)
|
||||
.catch(done.fail);
|
||||
expect(wrapper.find(Icon).exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,59 +1,50 @@
|
|||
import Vue from 'vue';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import Icon from '~/vue_shared/components/icon.vue';
|
||||
import ScrollButton from '~/ide/components/jobs/detail/scroll_button.vue';
|
||||
import mountComponent from '../../../../helpers/vue_mount_component_helper';
|
||||
|
||||
describe('IDE job log scroll button', () => {
|
||||
const Component = Vue.extend(ScrollButton);
|
||||
let vm;
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
vm = mountComponent(Component, {
|
||||
direction: 'up',
|
||||
disabled: false,
|
||||
const createComponent = props => {
|
||||
wrapper = shallowMount(ScrollButton, {
|
||||
propsData: {
|
||||
direction: 'up',
|
||||
disabled: false,
|
||||
...props,
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
vm.$destroy();
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
describe('iconName', () => {
|
||||
['up', 'down'].forEach(direction => {
|
||||
it(`returns icon name for ${direction}`, () => {
|
||||
vm.direction = direction;
|
||||
describe.each`
|
||||
direction | icon | title
|
||||
${'up'} | ${'scroll_up'} | ${'Scroll to top'}
|
||||
${'down'} | ${'scroll_down'} | ${'Scroll to bottom'}
|
||||
`('for $direction direction', ({ direction, icon, title }) => {
|
||||
beforeEach(() => createComponent({ direction }));
|
||||
|
||||
expect(vm.iconName).toBe(`scroll_${direction}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('tooltipTitle', () => {
|
||||
it('returns title for up', () => {
|
||||
expect(vm.tooltipTitle).toBe('Scroll to top');
|
||||
it('returns proper icon name', () => {
|
||||
expect(wrapper.find(Icon).props('name')).toBe(icon);
|
||||
});
|
||||
|
||||
it('returns title for down', () => {
|
||||
vm.direction = 'down';
|
||||
|
||||
expect(vm.tooltipTitle).toBe('Scroll to bottom');
|
||||
it('returns proper title', () => {
|
||||
expect(wrapper.attributes('data-original-title')).toBe(title);
|
||||
});
|
||||
});
|
||||
|
||||
it('emits click event on click', () => {
|
||||
jest.spyOn(vm, '$emit').mockImplementation(() => {});
|
||||
createComponent();
|
||||
|
||||
vm.$el.querySelector('.btn-scroll').click();
|
||||
|
||||
expect(vm.$emit).toHaveBeenCalledWith('click');
|
||||
wrapper.find('button').trigger('click');
|
||||
expect(wrapper.emitted().click).toBeDefined();
|
||||
});
|
||||
|
||||
it('disables button when disabled is true', done => {
|
||||
vm.disabled = true;
|
||||
it('disables button when disabled is true', () => {
|
||||
createComponent({ disabled: true });
|
||||
|
||||
vm.$nextTick(() => {
|
||||
expect(vm.$el.querySelector('.btn-scroll').hasAttribute('disabled')).toBe(true);
|
||||
|
||||
done();
|
||||
});
|
||||
expect(wrapper.find('button').attributes('disabled')).toBe('disabled');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,167 +1,177 @@
|
|||
import Vue from 'vue';
|
||||
import mountComponent from 'helpers/vue_mount_component_helper';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { TEST_HOST } from 'helpers/test_constants';
|
||||
import { GlLoadingIcon } from '@gitlab/ui';
|
||||
import ClientsideNavigator from '~/ide/components/preview/navigator.vue';
|
||||
import { listen } from 'codesandbox-api';
|
||||
|
||||
jest.mock('codesandbox-api', () => ({
|
||||
listen: jest.fn().mockReturnValue(jest.fn()),
|
||||
}));
|
||||
|
||||
describe('IDE clientside preview navigator', () => {
|
||||
let vm;
|
||||
let Component;
|
||||
let wrapper;
|
||||
let manager;
|
||||
let listenHandler;
|
||||
|
||||
beforeAll(() => {
|
||||
Component = Vue.extend(ClientsideNavigator);
|
||||
});
|
||||
const findBackButton = () => wrapper.findAll('button').at(0);
|
||||
const findForwardButton = () => wrapper.findAll('button').at(1);
|
||||
const findRefreshButton = () => wrapper.findAll('button').at(2);
|
||||
|
||||
beforeEach(() => {
|
||||
listen.mockClear();
|
||||
manager = { bundlerURL: TEST_HOST, iframe: { src: '' } };
|
||||
|
||||
vm = mountComponent(Component, { manager });
|
||||
wrapper = shallowMount(ClientsideNavigator, { propsData: { manager } });
|
||||
[[listenHandler]] = listen.mock.calls;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vm.$destroy();
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('renders readonly URL bar', () => {
|
||||
expect(vm.$el.querySelector('input[readonly]').value).toBe('/');
|
||||
});
|
||||
|
||||
it('disables back button when navigationStack is empty', () => {
|
||||
expect(vm.$el.querySelector('.ide-navigator-btn')).toHaveAttr('disabled');
|
||||
expect(vm.$el.querySelector('.ide-navigator-btn').classList).toContain('disabled-content');
|
||||
});
|
||||
|
||||
it('disables forward button when forwardNavigationStack is empty', () => {
|
||||
vm.forwardNavigationStack = [];
|
||||
|
||||
expect(vm.$el.querySelectorAll('.ide-navigator-btn')[1]).toHaveAttr('disabled');
|
||||
expect(vm.$el.querySelectorAll('.ide-navigator-btn')[1].classList).toContain(
|
||||
'disabled-content',
|
||||
);
|
||||
});
|
||||
|
||||
it('calls back method when clicking back button', done => {
|
||||
vm.navigationStack.push('/test');
|
||||
vm.navigationStack.push('/test2');
|
||||
jest.spyOn(vm, 'back').mockReturnValue();
|
||||
|
||||
vm.$nextTick(() => {
|
||||
vm.$el.querySelector('.ide-navigator-btn').click();
|
||||
|
||||
expect(vm.back).toHaveBeenCalled();
|
||||
|
||||
done();
|
||||
listenHandler({ type: 'urlchange', url: manager.bundlerURL });
|
||||
return wrapper.vm.$nextTick(() => {
|
||||
expect(wrapper.find('input[readonly]').element.value).toBe('/');
|
||||
});
|
||||
});
|
||||
|
||||
it('calls forward method when clicking forward button', done => {
|
||||
vm.forwardNavigationStack.push('/test');
|
||||
jest.spyOn(vm, 'forward').mockReturnValue();
|
||||
it('renders loading icon by default', () => {
|
||||
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true);
|
||||
});
|
||||
|
||||
vm.$nextTick(() => {
|
||||
vm.$el.querySelectorAll('.ide-navigator-btn')[1].click();
|
||||
|
||||
expect(vm.forward).toHaveBeenCalled();
|
||||
|
||||
done();
|
||||
it('removes loading icon when done event is fired', () => {
|
||||
listenHandler({ type: 'done' });
|
||||
return wrapper.vm.$nextTick(() => {
|
||||
expect(wrapper.find(GlLoadingIcon).exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('onUrlChange', () => {
|
||||
it('updates the path', () => {
|
||||
vm.onUrlChange({ url: `${TEST_HOST}/url` });
|
||||
|
||||
expect(vm.path).toBe('/url');
|
||||
});
|
||||
|
||||
it('sets currentBrowsingIndex 0 if not already set', () => {
|
||||
vm.onUrlChange({ url: `${TEST_HOST}/url` });
|
||||
|
||||
expect(vm.currentBrowsingIndex).toBe(0);
|
||||
});
|
||||
|
||||
it('increases currentBrowsingIndex if path doesnt match', () => {
|
||||
vm.onUrlChange({ url: `${TEST_HOST}/url` });
|
||||
|
||||
vm.onUrlChange({ url: `${TEST_HOST}/url2` });
|
||||
|
||||
expect(vm.currentBrowsingIndex).toBe(1);
|
||||
});
|
||||
|
||||
it('does not increase currentBrowsingIndex if path matches', () => {
|
||||
vm.onUrlChange({ url: `${TEST_HOST}/url` });
|
||||
|
||||
vm.onUrlChange({ url: `${TEST_HOST}/url` });
|
||||
|
||||
expect(vm.currentBrowsingIndex).toBe(0);
|
||||
});
|
||||
|
||||
it('pushes path into navigation stack', () => {
|
||||
vm.onUrlChange({ url: `${TEST_HOST}/url` });
|
||||
|
||||
expect(vm.navigationStack).toEqual(['/url']);
|
||||
it('does not count visiting same url multiple times', () => {
|
||||
listenHandler({ type: 'done' });
|
||||
listenHandler({ type: 'done', url: `${TEST_HOST}/url1` });
|
||||
listenHandler({ type: 'done', url: `${TEST_HOST}/url1` });
|
||||
return wrapper.vm.$nextTick().then(() => {
|
||||
expect(findBackButton().attributes('disabled')).toBe('disabled');
|
||||
});
|
||||
});
|
||||
|
||||
describe('back', () => {
|
||||
it('unsubscribes from listen on destroy', () => {
|
||||
const unsubscribeFn = listen();
|
||||
|
||||
wrapper.destroy();
|
||||
expect(unsubscribeFn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe('back button', () => {
|
||||
beforeEach(() => {
|
||||
vm.path = '/test2';
|
||||
vm.currentBrowsingIndex = 1;
|
||||
vm.navigationStack.push('/test');
|
||||
vm.navigationStack.push('/test2');
|
||||
|
||||
jest.spyOn(vm, 'visitPath').mockReturnValue();
|
||||
|
||||
vm.back();
|
||||
listenHandler({ type: 'done' });
|
||||
listenHandler({ type: 'urlchange', url: TEST_HOST });
|
||||
return wrapper.vm.$nextTick();
|
||||
});
|
||||
|
||||
it('visits the last entry in navigationStack', () => {
|
||||
expect(vm.visitPath).toHaveBeenCalledWith('/test');
|
||||
it('is disabled by default', () => {
|
||||
expect(findBackButton().attributes('disabled')).toBe('disabled');
|
||||
});
|
||||
|
||||
it('adds last entry to forwardNavigationStack', () => {
|
||||
expect(vm.forwardNavigationStack).toEqual(['/test2']);
|
||||
it('is enabled when there is previous entry', () => {
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url1` });
|
||||
return wrapper.vm.$nextTick().then(() => {
|
||||
findBackButton().trigger('click');
|
||||
expect(findBackButton().attributes('disabled')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
it('clears navigation stack if currentBrowsingIndex is 1', () => {
|
||||
expect(vm.navigationStack).toEqual([]);
|
||||
it('is disabled when there is no previous entry', () => {
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url1` });
|
||||
return wrapper.vm
|
||||
.$nextTick()
|
||||
.then(() => {
|
||||
findBackButton().trigger('click');
|
||||
|
||||
return wrapper.vm.$nextTick();
|
||||
})
|
||||
.then(() => {
|
||||
expect(findBackButton().attributes('disabled')).toBe('disabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('sets currentBrowsingIndex to null is currentBrowsingIndex is 1', () => {
|
||||
expect(vm.currentBrowsingIndex).toBe(null);
|
||||
it('updates manager iframe src', () => {
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url1` });
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url2` });
|
||||
return wrapper.vm.$nextTick().then(() => {
|
||||
findBackButton().trigger('click');
|
||||
|
||||
expect(manager.iframe.src).toBe(`${TEST_HOST}/url1`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('forward', () => {
|
||||
it('calls visitPath with first entry in forwardNavigationStack', () => {
|
||||
jest.spyOn(vm, 'visitPath').mockReturnValue();
|
||||
describe('forward button', () => {
|
||||
beforeEach(() => {
|
||||
listenHandler({ type: 'done' });
|
||||
listenHandler({ type: 'urlchange', url: TEST_HOST });
|
||||
return wrapper.vm.$nextTick();
|
||||
});
|
||||
|
||||
vm.forwardNavigationStack.push('/test');
|
||||
vm.forwardNavigationStack.push('/test2');
|
||||
it('is disabled by default', () => {
|
||||
expect(findForwardButton().attributes('disabled')).toBe('disabled');
|
||||
});
|
||||
|
||||
vm.forward();
|
||||
it('is enabled when there is next entry', () => {
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url1` });
|
||||
return wrapper.vm
|
||||
.$nextTick()
|
||||
.then(() => {
|
||||
findBackButton().trigger('click');
|
||||
return wrapper.vm.$nextTick();
|
||||
})
|
||||
.then(() => {
|
||||
expect(findForwardButton().attributes('disabled')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
expect(vm.visitPath).toHaveBeenCalledWith('/test');
|
||||
it('is disabled when there is no next entry', () => {
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url1` });
|
||||
return wrapper.vm
|
||||
.$nextTick()
|
||||
.then(() => {
|
||||
findBackButton().trigger('click');
|
||||
return wrapper.vm.$nextTick();
|
||||
})
|
||||
.then(() => {
|
||||
findForwardButton().trigger('click');
|
||||
return wrapper.vm.$nextTick();
|
||||
})
|
||||
.then(() => {
|
||||
expect(findForwardButton().attributes('disabled')).toBe('disabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('updates manager iframe src', () => {
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url1` });
|
||||
listenHandler({ type: 'urlchange', url: `${TEST_HOST}/url2` });
|
||||
return wrapper.vm.$nextTick().then(() => {
|
||||
findBackButton().trigger('click');
|
||||
|
||||
expect(manager.iframe.src).toBe(`${TEST_HOST}/url1`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('refresh', () => {
|
||||
describe('refresh button', () => {
|
||||
const url = `${TEST_HOST}/some_url`;
|
||||
beforeEach(() => {
|
||||
listenHandler({ type: 'done' });
|
||||
listenHandler({ type: 'urlchange', url });
|
||||
return wrapper.vm.$nextTick();
|
||||
});
|
||||
|
||||
it('calls refresh with current path', () => {
|
||||
jest.spyOn(vm, 'visitPath').mockReturnValue();
|
||||
manager.iframe.src = 'something-other';
|
||||
findRefreshButton().trigger('click');
|
||||
|
||||
vm.path = '/test';
|
||||
|
||||
vm.refresh();
|
||||
|
||||
expect(vm.visitPath).toHaveBeenCalledWith('/test');
|
||||
});
|
||||
});
|
||||
|
||||
describe('visitPath', () => {
|
||||
it('updates iframe src with passed in path', () => {
|
||||
vm.visitPath('/testpath');
|
||||
|
||||
expect(manager.iframe.src).toBe(`${TEST_HOST}/testpath`);
|
||||
expect(manager.iframe.src).toBe(url);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,25 +30,39 @@ describe API::GroupExport do
|
|||
group.add_owner(user)
|
||||
end
|
||||
|
||||
context 'when export file exists' do
|
||||
context 'group_import_export feature flag enabled' do
|
||||
before do
|
||||
upload.export_file = fixture_file_upload('spec/fixtures/group_export.tar.gz', "`/tar.gz")
|
||||
upload.save!
|
||||
stub_feature_flags(group_import_export: true)
|
||||
end
|
||||
|
||||
it 'downloads exported group archive' do
|
||||
get api(download_path, user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
context 'when export_file.file does not exist' do
|
||||
context 'when export file exists' do
|
||||
before do
|
||||
expect_next_instance_of(ImportExportUploader) do |uploader|
|
||||
expect(uploader).to receive(:file).and_return(nil)
|
||||
end
|
||||
upload.export_file = fixture_file_upload('spec/fixtures/group_export.tar.gz', "`/tar.gz")
|
||||
upload.save!
|
||||
end
|
||||
|
||||
it 'downloads exported group archive' do
|
||||
get api(download_path, user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
context 'when export_file.file does not exist' do
|
||||
before do
|
||||
expect_next_instance_of(ImportExportUploader) do |uploader|
|
||||
expect(uploader).to receive(:file).and_return(nil)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns 404' do
|
||||
get api(download_path, user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when export file does not exist' do
|
||||
it 'returns 404' do
|
||||
get api(download_path, user)
|
||||
|
||||
|
@ -57,8 +71,12 @@ describe API::GroupExport do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when export file does not exist' do
|
||||
it 'returns 404' do
|
||||
context 'group_import_export feature flag disabled' do
|
||||
before do
|
||||
stub_feature_flags(group_import_export: false)
|
||||
end
|
||||
|
||||
it 'responds with 404 Not Found' do
|
||||
get api(download_path, user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
|
@ -67,27 +85,45 @@ describe API::GroupExport do
|
|||
end
|
||||
|
||||
describe 'POST /groups/:group_id/export' do
|
||||
context 'when user is a group owner' do
|
||||
context 'group_import_export feature flag enabled' do
|
||||
before do
|
||||
group.add_owner(user)
|
||||
stub_feature_flags(group_import_export: true)
|
||||
end
|
||||
|
||||
it 'accepts download' do
|
||||
post api(path, user)
|
||||
context 'when user is a group owner' do
|
||||
before do
|
||||
group.add_owner(user)
|
||||
end
|
||||
|
||||
expect(response).to have_gitlab_http_status(202)
|
||||
it 'accepts download' do
|
||||
post api(path, user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(202)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is not a group owner' do
|
||||
before do
|
||||
group.add_developer(user)
|
||||
end
|
||||
|
||||
it 'forbids the request' do
|
||||
post api(path, user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is not a group owner' do
|
||||
context 'group_import_export feature flag disabled' do
|
||||
before do
|
||||
group.add_developer(user)
|
||||
stub_feature_flags(group_import_export: false)
|
||||
end
|
||||
|
||||
it 'forbids the request' do
|
||||
it 'responds with 404 Not Found' do
|
||||
post api(path, user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue