Skip to content
Snippets Groups Projects
Commit 0d6fa033 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 0eb3d2f7
No related branches found
No related tags found
No related merge requests found
Showing
with 96 additions and 129 deletions
Loading
Loading
@@ -86,7 +86,7 @@ describe Import::GitlabController do
 
post :create, format: :json
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
 
it 'returns 422 response when the project could not be imported' do
Loading
Loading
@@ -96,7 +96,7 @@ describe Import::GitlabController do
 
post :create, format: :json
 
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
 
context "when the repository owner is the GitLab.com user" do
Loading
Loading
@@ -279,7 +279,7 @@ describe Import::GitlabController do
 
post :create, params: { target_namespace: other_namespace.name }, format: :json
 
expect(response).to have_gitlab_http_status(422)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
 
Loading
Loading
Loading
Loading
@@ -17,14 +17,14 @@ describe Import::GitlabProjectsController do
post :create, params: { namespace_id: namespace.id, path: '/test', file: file }
 
expect(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
 
it 'redirects with an error when a relative path is used' do
post :create, params: { namespace_id: namespace.id, path: '../test', file: file }
 
expect(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
 
Loading
Loading
@@ -33,7 +33,7 @@ describe Import::GitlabProjectsController do
post :create, params: { namespace_id: namespace.id, path: 'test', file: file }
 
expect(flash[:notice]).to include('is being imported')
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
 
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@ describe Import::PhabricatorController do
stub_application_setting(import_sources: [])
end
 
it { is_expected.to have_gitlab_http_status(404) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
 
context 'when the feature is disabled' do
Loading
Loading
@@ -27,7 +27,7 @@ describe Import::PhabricatorController do
stub_application_setting(import_sources: ['phabricator'])
end
 
it { is_expected.to have_gitlab_http_status(404) }
it { is_expected.to have_gitlab_http_status(:not_found) }
end
 
context 'when the import is available' do
Loading
Loading
@@ -36,7 +36,7 @@ describe Import::PhabricatorController do
stub_application_setting(import_sources: ['phabricator'])
end
 
it { is_expected.to have_gitlab_http_status(200) }
it { is_expected.to have_gitlab_http_status(:ok) }
end
end
 
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ describe Oauth::ApplicationsController do
it 'shows list of applications' do
get :index
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
 
it 'redirects back to profile page if OAuth applications are disabled' do
Loading
Loading
@@ -22,7 +22,7 @@ describe Oauth::ApplicationsController do
 
get :index
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
 
Loading
Loading
@@ -30,7 +30,7 @@ describe Oauth::ApplicationsController do
it 'creates an application' do
post :create, params: oauth_params
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last))
end
 
Loading
Loading
@@ -39,7 +39,7 @@ describe Oauth::ApplicationsController do
 
post :create, params: oauth_params
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(profile_path)
end
 
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@ describe Oauth::AuthorizationsController do
it 'returns 200 code and renders error view' do
get :new
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/error')
end
end
Loading
Loading
@@ -34,7 +34,7 @@ describe Oauth::AuthorizationsController do
it 'returns 200 code and renders view' do
get :new, params: params
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/new')
end
 
Loading
Loading
@@ -45,7 +45,7 @@ describe Oauth::AuthorizationsController do
get :new, params: params
 
expect(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
 
context 'when there is already an access token for the application' do
Loading
Loading
@@ -62,7 +62,7 @@ describe Oauth::AuthorizationsController do
get :new, params: params
 
expect(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
end
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ describe Profiles::AccountsController do
it 'renders 404 if someone tries to unlink a non existent provider' do
delete :unlink, params: { provider: 'github' }
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
 
[:saml, :cas3].each do |provider|
Loading
Loading
@@ -25,7 +25,7 @@ describe Profiles::AccountsController do
 
delete :unlink, params: { provider: provider.to_s }
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(user.reload.identities).to include(identity)
end
end
Loading
Loading
@@ -40,7 +40,7 @@ describe Profiles::AccountsController do
 
delete :unlink, params: { provider: provider.to_s }
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
expect(user.reload.identities).not_to include(identity)
end
end
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ describe Snippets::NotesController do
end
 
it "returns status 200" do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
 
it "returns not empty array of notes" do
Loading
Loading
@@ -39,7 +39,7 @@ describe Snippets::NotesController do
it "returns status 404" do
get :index, params: { snippet_id: internal_snippet }
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
 
Loading
Loading
@@ -51,7 +51,7 @@ describe Snippets::NotesController do
it "returns status 200" do
get :index, params: { snippet_id: internal_snippet }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
end
Loading
Loading
@@ -65,7 +65,7 @@ describe Snippets::NotesController do
it "returns status 404" do
get :index, params: { snippet_id: private_snippet }
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
 
Loading
Loading
@@ -77,7 +77,7 @@ describe Snippets::NotesController do
it "returns status 404" do
get :index, params: { snippet_id: private_snippet }
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
 
Loading
Loading
@@ -91,7 +91,7 @@ describe Snippets::NotesController do
it "returns status 200" do
get :index, params: { snippet_id: private_snippet }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
 
it "returns 1 note" do
Loading
Loading
@@ -135,7 +135,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
 
it 'creates the note' do
Loading
Loading
@@ -158,7 +158,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
 
it 'creates the note' do
Loading
Loading
@@ -186,7 +186,7 @@ describe Snippets::NotesController do
it 'returns status 404' 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 the note' do
Loading
Loading
@@ -204,7 +204,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
 
it 'creates the note on the public snippet' do
Loading
Loading
@@ -222,7 +222,7 @@ describe Snippets::NotesController do
it 'returns status 302' do
post :create, params: request_params
 
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
 
it 'creates the note' do
Loading
Loading
@@ -249,7 +249,7 @@ describe Snippets::NotesController do
it "returns status 200" 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
Loading
Loading
@@ -277,7 +277,7 @@ describe Snippets::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
 
it "does not update the note" do
Loading
Loading
@@ -299,7 +299,7 @@ describe Snippets::NotesController do
it "toggles the award emoji" do
expect { subject }.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 when it exists" do
Loading
Loading
@@ -307,7 +307,7 @@ describe Snippets::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
end
end
Loading
Loading
@@ -13,7 +13,7 @@ describe UserCalloutsController do
subject { post :create, params: { feature_name: feature_name }, format: :json }
 
context 'with valid feature name' do
let(:feature_name) { UserCallout.feature_names.first.first }
let(:feature_name) { UserCallout.feature_names.keys.first }
 
context 'when callout entry does not exist' do
it 'creates a callout entry with dismissed state' do
Loading
Loading
@@ -28,7 +28,7 @@ describe UserCalloutsController do
end
 
context 'when callout entry already exists' do
let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.first.first, user: user) }
let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.keys.first, user: user) }
 
it 'returns success' do
subject
Loading
Loading
# frozen_string_literal: true
FactoryBot.define do
factory :prometheus_alert do
project
operator { :gt }
threshold { 1 }
environment do |alert|
build(:environment, project: alert.project)
end
prometheus_metric do |alert|
build(:prometheus_metric, project: alert.project)
end
end
end
Loading
Loading
@@ -187,7 +187,7 @@ describe 'User creates branch and merge request on issue page', :js do
let(:branch_name) { "#{issue.iid}-foo" }
 
before do
project.repository.create_branch(branch_name, 'master')
project.repository.create_branch(branch_name)
 
visit project_issue_path(project, issue)
end
Loading
Loading
Loading
Loading
@@ -46,7 +46,7 @@ describe 'Merge request > User posts diff notes', :js do
end
 
context 'with an old line on the left and a new line on the right' do
it 'allows commenting on the left side' do
it 'allows commenting on the left side', quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/199050' do
should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9"]').find(:xpath, '..'), 'left')
end
 
Loading
Loading
Loading
Loading
@@ -169,8 +169,8 @@ describe 'Merge request > User resolves conflicts', :js do
 
context "with malicious branch name" do
let(:bad_branch_name) { "malicious-branch-{{toString.constructor('alert(/xss/)')()}}" }
let(:branch) { project.repository.create_branch(bad_branch_name, 'conflict-resolvable') }
let(:merge_request) { create_merge_request(branch.name) }
let!(:branch) { project.repository.create_branch(bad_branch_name, 'conflict-resolvable') }
let(:merge_request) { create_merge_request(bad_branch_name) }
 
before do
visit project_merge_request_path(project, merge_request)
Loading
Loading
Loading
Loading
@@ -60,7 +60,7 @@ describe 'Project Graph', :js do
let(:branch_name) { '<h1>evil</h1>' }
 
before do
project.repository.create_branch(branch_name, 'master')
project.repository.create_branch(branch_name)
 
visit charts_project_graph_path(project, branch_name)
end
Loading
Loading
Loading
Loading
@@ -2398,7 +2398,7 @@
"requested_at": null,
"user": {
"id": 16,
"email": "maritza_schoen@block.ca",
"email": "bernard_willms@gitlabexample.com",
"username": "bernard_willms"
}
},
Loading
Loading
@@ -2418,7 +2418,7 @@
"requested_at": null,
"user": {
"id": 6,
"email": "shaina@koelpindenesik.com",
"email": "saul_will@gitlabexample.com",
"username": "saul_will"
}
},
Loading
Loading
Loading
Loading
@@ -348,7 +348,7 @@
"override": false,
"user": {
"id": 206,
"email": "margaret.bergnaum@reynolds.us",
"email": "gwendolyn_robel@gitlabexample.com",
"username": "gwendolyn_robel"
}
},
Loading
Loading
@@ -394,7 +394,7 @@
"override": false,
"user": {
"id": 1624,
"email": "nakesha.herzog@powlowski.com",
"email": "adriene.mcclure@gitlabexample.com",
"username": "adriene.mcclure"
}
},
Loading
Loading
Loading
Loading
@@ -12,7 +12,8 @@ describe Types::PermissionTypes::Project do
:read_commit_status, :request_access, :create_pipeline, :create_pipeline_schedule,
:create_merge_request_from, :create_wiki, :push_code, :create_deployment, :push_to_delete_protected_branch,
:admin_wiki, :admin_project, :update_pages, :admin_remote_mirror, :create_label,
:update_wiki, :destroy_wiki, :create_pages, :destroy_pages, :read_pages_content
:update_wiki, :destroy_wiki, :create_pages, :destroy_pages, :read_pages_content,
:read_merge_request
]
 
expected_permissions.each do |permission|
Loading
Loading
Loading
Loading
@@ -403,7 +403,7 @@ describe MarkupHelper do
it 'logs the error' do
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
instance_of(StandardError),
project_id: project.id, file_name: 'foo.md', context: context
project_id: project.id, file_name: 'foo.md'
)
 
subject
Loading
Loading
Loading
Loading
@@ -310,8 +310,8 @@ describe Gitlab::Git::Repository, :seed_helper do
 
with_them do
before do
repository.create_branch('left-branch', 'master')
repository.create_branch('right-branch', 'master')
repository.create_branch('left-branch')
repository.create_branch('right-branch')
 
left.times do
new_commit_edit_new_file_on_branch(repository_rugged, 'encoding/CHANGELOG', 'left-branch', 'some more content for a', 'some stuff')
Loading
Loading
@@ -350,8 +350,8 @@ describe Gitlab::Git::Repository, :seed_helper do
 
with_them do
before do
repository.create_branch('left-branch', 'master')
repository.create_branch('right-branch', 'master')
repository.create_branch('left-branch')
repository.create_branch('right-branch')
 
left.times do
new_commit_edit_new_file_on_branch(repository_rugged, 'encoding/CHANGELOG', 'left-branch', 'some more content for a', 'some stuff')
Loading
Loading
@@ -420,55 +420,6 @@ describe Gitlab::Git::Repository, :seed_helper do
end
end
 
describe "#delete_branch" do
let(:repository) { mutable_repository }
after do
ensure_seeds
end
it "removes the branch from the repo" do
branch_name = "to-be-deleted-soon"
repository.create_branch(branch_name)
expect(repository_rugged.branches[branch_name]).not_to be_nil
repository.delete_branch(branch_name)
expect(repository_rugged.branches[branch_name]).to be_nil
end
context "when branch does not exist" do
it "raises a DeleteBranchError exception" do
expect { repository.delete_branch("this-branch-does-not-exist") }.to raise_error(Gitlab::Git::Repository::DeleteBranchError)
end
end
end
describe "#create_branch" do
let(:repository) { mutable_repository }
after do
ensure_seeds
end
it "creates a new branch" do
expect(repository.create_branch('new_branch', 'master')).not_to be_nil
end
it "creates a new branch with the right name" do
expect(repository.create_branch('another_branch', 'master').name).to eq('another_branch')
end
it "fails if we create an existing branch" do
repository.create_branch('duplicated_branch', 'master')
expect {repository.create_branch('duplicated_branch', 'master')}.to raise_error("Branch duplicated_branch already exists")
end
it "fails if we create a branch from a non existing ref" do
expect {repository.create_branch('branch_based_in_wrong_ref', 'master_2_the_revenge')}.to raise_error("Invalid reference master_2_the_revenge")
end
end
describe '#delete_refs' do
let(:repository) { mutable_repository }
 
Loading
Loading
@@ -506,8 +457,8 @@ describe Gitlab::Git::Repository, :seed_helper do
let(:utf8_branch) { 'branch-é' }
 
before do
repository.create_branch(new_branch, 'master')
repository.create_branch(utf8_branch, 'master')
repository.create_branch(new_branch)
repository.create_branch(utf8_branch)
end
 
after do
Loading
Loading
@@ -609,32 +560,30 @@ describe Gitlab::Git::Repository, :seed_helper do
describe '#search_files_by_content' do
let(:repository) { mutable_repository }
let(:repository_rugged) { mutable_repository_rugged }
let(:ref) { 'search-files-by-content-branch' }
let(:content) { 'foobarbazmepmep' }
 
before do
repository.create_branch('search-files-by-content-branch', 'master')
new_commit_edit_new_file_on_branch(repository_rugged, 'encoding/CHANGELOG', 'search-files-by-content-branch', 'committing something', 'search-files-by-content change')
new_commit_edit_new_file_on_branch(repository_rugged, 'anotherfile', 'search-files-by-content-branch', 'committing something', 'search-files-by-content change')
repository.create_branch(ref)
new_commit_edit_new_file_on_branch(repository_rugged, 'encoding/CHANGELOG', ref, 'committing something', content)
new_commit_edit_new_file_on_branch(repository_rugged, 'anotherfile', ref, 'committing something', content)
end
 
after do
ensure_seeds
end
 
shared_examples 'search files by content' do
it 'has 2 items' do
expect(search_results.size).to eq(2)
end
subject do
repository.search_files_by_content(content, ref)
end
 
it 'has the correct matching line' do
expect(search_results).to contain_exactly("search-files-by-content-branch:encoding/CHANGELOG\u00001\u0000search-files-by-content change\n",
"search-files-by-content-branch:anotherfile\u00001\u0000search-files-by-content change\n")
end
it 'has 2 items' do
expect(subject.size).to eq(2)
end
 
it_should_behave_like 'search files by content' do
let(:search_results) do
repository.search_files_by_content('search-files-by-content', 'search-files-by-content-branch')
end
it 'has the correct matching line' do
expect(subject).to contain_exactly("#{ref}:encoding/CHANGELOG\u00001\u0000#{content}\n",
"#{ref}:anotherfile\u00001\u0000#{content}\n")
end
end
 
Loading
Loading
@@ -1116,7 +1065,7 @@ describe Gitlab::Git::Repository, :seed_helper do
 
before do
create_remote_branch('joe', 'remote_branch', 'master')
repository.create_branch('local_branch', 'master')
repository.create_branch('local_branch')
end
 
after do
Loading
Loading
@@ -1142,7 +1091,7 @@ describe Gitlab::Git::Repository, :seed_helper do
 
before do
create_remote_branch('joe', 'remote_branch', 'master')
repository.create_branch('local_branch', 'master')
repository.create_branch('local_branch')
end
 
after do
Loading
Loading
@@ -1192,7 +1141,7 @@ describe Gitlab::Git::Repository, :seed_helper do
 
context 'when no branch names are specified' do
before do
repository.create_branch('identical', 'master')
repository.create_branch('identical')
end
 
after do
Loading
Loading
@@ -1303,7 +1252,7 @@ describe Gitlab::Git::Repository, :seed_helper do
let(:branch_name) { "ʕ•ᴥ•ʔ" }
 
before do
repository.create_branch(branch_name, "master")
repository.create_branch(branch_name)
end
 
after do
Loading
Loading
@@ -1447,7 +1396,7 @@ describe Gitlab::Git::Repository, :seed_helper do
 
before do
create_remote_branch('joe', 'remote_branch', 'master')
repository.create_branch('local_branch', 'master')
repository.create_branch('local_branch')
end
 
after do
Loading
Loading
Loading
Loading
@@ -10,9 +10,9 @@ describe Gitlab::ImportExport::GroupTreeRestorer do
describe 'restore group tree' do
before(:context) do
# Using an admin for import, so we can check assignment of existing members
user = create(:admin, username: 'root')
create(:user, username: 'adriene.mcclure')
create(:user, username: 'gwendolyn_robel')
user = create(:admin, email: 'root@gitlabexample.com')
create(:user, email: 'adriene.mcclure@gitlabexample.com')
create(:user, email: 'gwendolyn_robel@gitlabexample.com')
 
RSpec::Mocks.with_temporary_scope do
@group = create(:group, name: 'group', path: 'group')
Loading
Loading
@@ -56,7 +56,7 @@ describe Gitlab::ImportExport::GroupTreeRestorer do
end
 
it 'has group members' do
expect(@group.members.map(&:user).map(&:username)).to contain_exactly('root', 'adriene.mcclure', 'gwendolyn_robel')
expect(@group.members.map(&:user).map(&:email)).to contain_exactly('root@gitlabexample.com', 'adriene.mcclure@gitlabexample.com', 'gwendolyn_robel@gitlabexample.com')
end
end
end
Loading
Loading
Loading
Loading
@@ -13,8 +13,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
# Using an admin for import, so we can check assignment of existing members
@user = create(:admin)
@existing_members = [
create(:user, username: 'bernard_willms'),
create(:user, username: 'saul_will')
create(:user, email: 'bernard_willms@gitlabexample.com'),
create(:user, email: 'saul_will@gitlabexample.com')
]
 
RSpec::Mocks.with_temporary_scope do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment