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

Add latest changes from gitlab-org/gitlab@master

parent eed996ac
No related branches found
No related tags found
No related merge requests found
Showing
with 105 additions and 29 deletions
Loading
Loading
@@ -927,6 +927,30 @@ describe ProjectsController do
expect(json_response['body']).to match(/\!#{merge_request.iid} \(closed\)/)
end
end
context 'when path parameter is provided' do
let(:project_with_repo) { create(:project, :repository) }
let(:preview_markdown_params) do
{
namespace_id: project_with_repo.namespace,
id: project_with_repo,
text: "![](./logo-white.png)\n",
path: 'files/images/README.md'
}
end
before do
project_with_repo.add_maintainer(user)
end
it 'renders JSON body with image links expanded' do
expanded_path = "/#{project_with_repo.full_path}/raw/master/files/images/logo-white.png"
post :preview_markdown, params: preview_markdown_params
expect(json_response['body']).to include(expanded_path)
end
end
end
 
describe '#ensure_canonical_path' do
Loading
Loading
Loading
Loading
@@ -174,7 +174,9 @@ describe UsersController do
let(:user) { create(:user) }
 
before do
allow_any_instance_of(User).to receive(:contributed_projects_ids).and_return([project.id])
allow_next_instance_of(User) do |instance|
allow(instance).to receive(:contributed_projects_ids).and_return([project.id])
end
 
sign_in(user)
project.add_developer(user)
Loading
Loading
Loading
Loading
@@ -73,8 +73,9 @@ describe "Admin::Projects" do
before do
create(:group, name: 'Web')
 
allow_any_instance_of(Projects::TransferService)
.to receive(:move_uploads_to_new_namespace).and_return(true)
allow_next_instance_of(Projects::TransferService) do |instance|
allow(instance).to receive(:move_uploads_to_new_namespace).and_return(true)
end
end
 
it 'transfers project to group web', :js do
Loading
Loading
Loading
Loading
@@ -179,7 +179,9 @@ describe "Admin::Users" do
end
 
it "calls send mail" do
expect_any_instance_of(NotificationService).to receive(:new_user)
expect_next_instance_of(NotificationService) do |instance|
expect(instance).to receive(:new_user)
end
 
click_button "Create user"
end
Loading
Loading
Loading
Loading
@@ -40,7 +40,9 @@ describe 'Cycle Analytics', :js do
 
context "when there's cycle analytics data" do
before do
allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return([issue])
allow_next_instance_of(Gitlab::ReferenceExtractor) do |instance|
allow(instance).to receive(:issues).and_return([issue])
end
project.add_maintainer(user)
 
@build = create_cycle(user, project, issue, mr, milestone, pipeline)
Loading
Loading
@@ -99,7 +101,9 @@ describe 'Cycle Analytics', :js do
project.add_developer(user)
project.add_guest(guest)
 
allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return([issue])
allow_next_instance_of(Gitlab::ReferenceExtractor) do |instance|
allow(instance).to receive(:issues).and_return([issue])
end
create_cycle(user, project, issue, mr, milestone, pipeline)
deploy_master(user, project)
 
Loading
Loading
Loading
Loading
@@ -21,7 +21,9 @@ describe 'Global search' do
 
describe 'I search through the issues and I see pagination' do
before do
allow_any_instance_of(Gitlab::SearchResults).to receive(:per_page).and_return(1)
allow_next_instance_of(Gitlab::SearchResults) do |instance|
allow(instance).to receive(:per_page).and_return(1)
end
create_list(:issue, 2, project: project, title: 'initial')
end
 
Loading
Loading
Loading
Loading
@@ -13,8 +13,12 @@ describe 'User Cluster', :js do
gitlab_sign_in(user)
 
allow(Groups::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 }
allow_any_instance_of(Clusters::Kubernetes::CreateOrUpdateNamespaceService).to receive(:execute)
allow_any_instance_of(Clusters::Cluster).to receive(:retrieve_connection_status).and_return(:connected)
allow_next_instance_of(Clusters::Kubernetes::CreateOrUpdateNamespaceService) do |instance|
allow(instance).to receive(:execute)
end
allow_next_instance_of(Clusters::Cluster) do |instance|
allow(instance).to receive(:retrieve_connection_status).and_return(:connected)
end
end
 
context 'when user does not have a cluster and visits cluster index page' do
Loading
Loading
Loading
Loading
@@ -17,7 +17,9 @@ describe "Jira", :js do
 
stub_request(:get, "https://jira.example.com/rest/api/2/issue/JIRA-5")
stub_request(:post, "https://jira.example.com/rest/api/2/issue/JIRA-5/comment")
allow_any_instance_of(JIRA::Resource::Issue).to receive(:remotelink).and_return(remotelink)
allow_next_instance_of(JIRA::Resource::Issue) do |instance|
allow(instance).to receive(:remotelink).and_return(remotelink)
end
 
sign_in(user)
 
Loading
Loading
Loading
Loading
@@ -47,7 +47,9 @@ describe 'User squashes a merge request', :js do
before do
# Prevent source branch from being removed so we can use be_merged_to_root_ref
# method to check if squash was performed or not
allow_any_instance_of(MergeRequest).to receive(:force_remove_source_branch?).and_return(false)
allow_next_instance_of(MergeRequest) do |instance|
allow(instance).to receive(:force_remove_source_branch?).and_return(false)
end
project.add_maintainer(user)
 
sign_in user
Loading
Loading
Loading
Loading
@@ -13,8 +13,12 @@ describe 'User Cluster', :js do
gitlab_sign_in(user)
 
allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 }
allow_any_instance_of(Clusters::Kubernetes::CreateOrUpdateNamespaceService).to receive(:execute)
allow_any_instance_of(Clusters::Cluster).to receive(:retrieve_connection_status).and_return(:connected)
allow_next_instance_of(Clusters::Kubernetes::CreateOrUpdateNamespaceService) do |instance|
allow(instance).to receive(:execute)
end
allow_next_instance_of(Clusters::Cluster) do |instance|
allow(instance).to receive(:retrieve_connection_status).and_return(:connected)
end
end
 
context 'when user does not have a cluster and visits cluster index page' do
Loading
Loading
Loading
Loading
@@ -57,7 +57,9 @@ describe 'User browses commits' do
 
create(:ci_build, pipeline: pipeline)
 
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file).and_return('')
allow_next_instance_of(Ci::Pipeline) do |instance|
allow(instance).to receive(:ci_yaml_file).and_return('')
end
end
 
it 'renders commit ci info' do
Loading
Loading
@@ -94,8 +96,12 @@ describe 'User browses commits' do
let(:commit) { create(:commit, project: project) }
 
it 'renders successfully' do
allow_any_instance_of(Gitlab::Diff::File).to receive(:blob).and_return(nil)
allow_any_instance_of(Gitlab::Diff::File).to receive(:binary?).and_return(true)
allow_next_instance_of(Gitlab::Diff::File) do |instance|
allow(instance).to receive(:blob).and_return(nil)
end
allow_next_instance_of(Gitlab::Diff::File) do |instance|
allow(instance).to receive(:binary?).and_return(true)
end
 
visit(project_commit_path(project, commit))
 
Loading
Loading
Loading
Loading
@@ -107,7 +107,9 @@ describe "Compare", :js do
visit project_compare_index_path(project, from: "feature", to: "master")
 
allow(Commit).to receive(:max_diff_options).and_return(max_files: 3)
allow_any_instance_of(DiffHelper).to receive(:render_overflow_warning?).and_return(true)
allow_next_instance_of(DiffHelper) do |instance|
allow(instance).to receive(:render_overflow_warning?).and_return(true)
end
 
click_button('Compare')
 
Loading
Loading
Loading
Loading
@@ -175,8 +175,9 @@ describe 'Environment' do
#
# In EE we have to stub EE::Environment since it overwrites
# the "terminals" method.
allow_any_instance_of(Gitlab.ee? ? EE::Environment : Environment)
.to receive(:terminals) { nil }
allow_next_instance_of(Gitlab.ee? ? EE::Environment : Environment) do |instance|
allow(instance).to receive(:terminals) { nil }
end
 
visit terminal_project_environment_path(project, environment)
end
Loading
Loading
Loading
Loading
@@ -71,7 +71,9 @@ describe 'Environments page', :js do
let!(:application_prometheus) { create(:clusters_applications_prometheus, :installed, cluster: cluster) }
 
before do
allow_any_instance_of(Kubeclient::Client).to receive(:proxy_url).and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil))
allow_next_instance_of(Kubeclient::Client) do |instance|
allow(instance).to receive(:proxy_url).and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil))
end
end
 
it 'shows one environment without error' do
Loading
Loading
Loading
Loading
@@ -42,7 +42,9 @@ describe 'Edit Project Settings' do
 
context 'When external issue tracker is enabled and issues enabled on project settings' do
it 'does not hide issues tab' do
allow_any_instance_of(Project).to receive(:external_issue_tracker).and_return(JiraService.new)
allow_next_instance_of(Project) do |instance|
allow(instance).to receive(:external_issue_tracker).and_return(JiraService.new)
end
 
visit project_path(project)
 
Loading
Loading
@@ -54,7 +56,9 @@ describe 'Edit Project Settings' do
it 'hides issues tab' do
project.issues_enabled = false
project.save!
allow_any_instance_of(Project).to receive(:external_issue_tracker).and_return(JiraService.new)
allow_next_instance_of(Project) do |instance|
allow(instance).to receive(:external_issue_tracker).and_return(JiraService.new)
end
 
visit project_path(project)
 
Loading
Loading
Loading
Loading
@@ -26,7 +26,9 @@ describe 'Import/Export - project export integration test', :js do
let(:project) { setup_project }
 
before do
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
allow_next_instance_of(Gitlab::ImportExport) do |instance|
allow(instance).to receive(:storage_path).and_return(export_path)
end
end
 
after do
Loading
Loading
Loading
Loading
@@ -11,7 +11,9 @@ describe 'Import/Export - project import integration test', :js do
 
before do
stub_uploads_object_storage(FileUploader)
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
allow_next_instance_of(Gitlab::ImportExport) do |instance|
allow(instance).to receive(:storage_path).and_return(export_path)
end
gitlab_sign_in(user)
end
 
Loading
Loading
Loading
Loading
@@ -18,7 +18,9 @@ describe "Pages with Let's Encrypt", :https_pages_enabled do
project.add_role(user, role)
sign_in(user)
project.namespace.update(owner: user)
allow_any_instance_of(Project).to receive(:pages_deployed?) { true }
allow_next_instance_of(Project) do |instance|
allow(instance).to receive(:pages_deployed?) { true }
end
end
 
context 'when the auto SSL management is initially disabled' do
Loading
Loading
Loading
Loading
@@ -264,7 +264,9 @@ describe "Internal Project Access" do
 
before do
# Speed increase
allow_any_instance_of(Project).to receive(:branches).and_return([])
allow_next_instance_of(Project) do |instance|
allow(instance).to receive(:branches).and_return([])
end
end
 
it { is_expected.to be_allowed_for(:admin) }
Loading
Loading
@@ -283,7 +285,9 @@ describe "Internal Project Access" do
 
before do
# Speed increase
allow_any_instance_of(Project).to receive(:tags).and_return([])
allow_next_instance_of(Project) do |instance|
allow(instance).to receive(:tags).and_return([])
end
end
 
it { is_expected.to be_allowed_for(:admin) }
Loading
Loading
Loading
Loading
@@ -236,7 +236,9 @@ describe "Private Project Access" do
 
before do
# Speed increase
allow_any_instance_of(Project).to receive(:branches).and_return([])
allow_next_instance_of(Project) do |instance|
allow(instance).to receive(:branches).and_return([])
end
end
 
it { is_expected.to be_allowed_for(:admin) }
Loading
Loading
@@ -255,7 +257,9 @@ describe "Private Project Access" do
 
before do
# Speed increase
allow_any_instance_of(Project).to receive(:tags).and_return([])
allow_next_instance_of(Project) do |instance|
allow(instance).to receive(:tags).and_return([])
end
end
 
it { is_expected.to be_allowed_for(:admin) }
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