diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 03:06:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 03:06:25 +0000 |
commit | 29c01c6c91558358c37ba45b03f240632bfb918d (patch) | |
tree | c6475afaf98ce740e8ba5fe227e7bd4a95b692cd /spec/features | |
parent | eed996ac33a60d5fd8315a62fec8beaa8e907e69 (diff) | |
download | gitlab-ce-29c01c6c91558358c37ba45b03f240632bfb918d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
21 files changed, 91 insertions, 33 deletions
diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 058e548208f..7c40ac5bde3 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -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 diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index 29f29e58917..0c8cd895c00 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -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 diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb index 3f46772c4b0..0fc4841ee0e 100644 --- a/spec/features/cycle_analytics_spec.rb +++ b/spec/features/cycle_analytics_spec.rb @@ -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) @@ -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) diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb index 00fa85930b1..c499fac6bc0 100644 --- a/spec/features/global_search_spec.rb +++ b/spec/features/global_search_spec.rb @@ -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 diff --git a/spec/features/groups/clusters/user_spec.rb b/spec/features/groups/clusters/user_spec.rb index 8891866c1f8..e06f2efe183 100644 --- a/spec/features/groups/clusters/user_spec.rb +++ b/spec/features/groups/clusters/user_spec.rb @@ -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 diff --git a/spec/features/issuables/markdown_references/jira_spec.rb b/spec/features/issuables/markdown_references/jira_spec.rb index 596a374ec6d..c5818691b3c 100644 --- a/spec/features/issuables/markdown_references/jira_spec.rb +++ b/spec/features/issuables/markdown_references/jira_spec.rb @@ -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) diff --git a/spec/features/merge_requests/user_squashes_merge_request_spec.rb b/spec/features/merge_requests/user_squashes_merge_request_spec.rb index a018c86fa9a..a9b96c5bbf5 100644 --- a/spec/features/merge_requests/user_squashes_merge_request_spec.rb +++ b/spec/features/merge_requests/user_squashes_merge_request_spec.rb @@ -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 diff --git a/spec/features/projects/clusters/user_spec.rb b/spec/features/projects/clusters/user_spec.rb index 84f2e3e09ae..bdaeda83926 100644 --- a/spec/features/projects/clusters/user_spec.rb +++ b/spec/features/projects/clusters/user_spec.rb @@ -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 diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb index 131d9097f48..1cff7f2c385 100644 --- a/spec/features/projects/commits/user_browses_commits_spec.rb +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -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 @@ -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)) diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index bdde04eec76..df5cec80ae4 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -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') diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index dd690699ff6..3eab13cb820 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -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 diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 1a2302b3d0c..74c2758c30f 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -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 diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index 9ec61743a11..5553e496e7a 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -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) @@ -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) diff --git a/spec/features/projects/import_export/export_file_spec.rb b/spec/features/projects/import_export/export_file_spec.rb index b3ed550f45e..c15a3250221 100644 --- a/spec/features/projects/import_export/export_file_spec.rb +++ b/spec/features/projects/import_export/export_file_spec.rb @@ -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 diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 904c5390415..33c7182c084 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -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 diff --git a/spec/features/projects/pages_lets_encrypt_spec.rb b/spec/features/projects/pages_lets_encrypt_spec.rb index 8b5964b2eee..c33a2896952 100644 --- a/spec/features/projects/pages_lets_encrypt_spec.rb +++ b/spec/features/projects/pages_lets_encrypt_spec.rb @@ -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 diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index 768b883a90e..9c1c81918fa 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -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) } @@ -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) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index c2d44c05a22..dbaf97bc3fd 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -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) } @@ -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) } diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index 19f01257713..35cbc195f4f 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -477,7 +477,9 @@ describe "Public 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) } @@ -496,7 +498,9 @@ describe "Public 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) } diff --git a/spec/features/tags/developer_deletes_tag_spec.rb b/spec/features/tags/developer_deletes_tag_spec.rb index 82b416c3a7f..0fc62a578f9 100644 --- a/spec/features/tags/developer_deletes_tag_spec.rb +++ b/spec/features/tags/developer_deletes_tag_spec.rb @@ -39,8 +39,10 @@ describe 'Developer deletes tag' do context 'when pre-receive hook fails', :js do before do - allow_any_instance_of(Gitlab::GitalyClient::OperationService).to receive(:rm_tag) - .and_raise(Gitlab::Git::PreReceiveError, 'GitLab: Do not delete tags') + allow_next_instance_of(Gitlab::GitalyClient::OperationService) do |instance| + allow(instance).to receive(:rm_tag) + .and_raise(Gitlab::Git::PreReceiveError, 'GitLab: Do not delete tags') + end end it 'shows the error message' do diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb index 29ff0c67dbd..3b19bd423a4 100644 --- a/spec/features/users/signup_spec.rb +++ b/spec/features/users/signup_spec.rb @@ -379,7 +379,9 @@ shared_examples 'Signup' do before do InvisibleCaptcha.timestamp_enabled = true stub_application_setting(recaptcha_enabled: true) - allow_any_instance_of(RegistrationsController).to receive(:verify_recaptcha).and_return(false) + allow_next_instance_of(RegistrationsController) do |instance| + allow(instance).to receive(:verify_recaptcha).and_return(false) + end end after do |