diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 15:07:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 15:07:43 +0300 |
commit | d10a462fedbd7794a83abdba9b4526600f71de5b (patch) | |
tree | 4dbd21cb89013d9e07b05bac5101cd13585a8be5 /spec/requests/api | |
parent | 13867d66e92c2fd8962a126db4fbdc32891343c9 (diff) |
Add latest changes from gitlab-org/gitlab@masterogolowinski-master-patch-80898
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/branches_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/files_spec.rb | 9 | ||||
-rw-r--r-- | spec/requests/api/graphql_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/groups_spec.rb | 5 | ||||
-rw-r--r-- | spec/requests/api/helpers_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/jobs_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/project_snippets_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/snippets_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/tags_spec.rb | 4 |
9 files changed, 39 insertions, 19 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index eda2f6d854f..99374d28324 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -629,7 +629,9 @@ describe API::Branches do describe 'DELETE /projects/:id/repository/branches/:branch' do before do - allow_any_instance_of(Repository).to receive(:rm_branch).and_return(true) + allow_next_instance_of(Repository) do |instance| + allow(instance).to receive(:rm_branch).and_return(true) + end end it 'removes branch' do @@ -666,7 +668,9 @@ describe API::Branches do describe 'DELETE /projects/:id/repository/merged_branches' do before do - allow_any_instance_of(Repository).to receive(:rm_branch).and_return(true) + allow_next_instance_of(Repository) do |instance| + allow(instance).to receive(:rm_branch).and_return(true) + end end it 'returns 202 with json body' do diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index f1e1b8df8ee..ab915af8ab0 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -548,8 +548,9 @@ describe API::Files do end it "returns a 400 if editor fails to create file" do - allow_any_instance_of(Repository).to receive(:create_file) - .and_raise(Gitlab::Git::CommitError, 'Cannot create file') + allow_next_instance_of(Repository) do |instance| + allow(instance).to receive(:create_file).and_raise(Gitlab::Git::CommitError, 'Cannot create file') + end post api(route("any%2Etxt"), user), params: params @@ -698,7 +699,9 @@ describe API::Files do end it "returns a 400 if fails to delete file" do - allow_any_instance_of(Repository).to receive(:delete_file).and_raise(Gitlab::Git::CommitError, 'Cannot delete file') + allow_next_instance_of(Repository) do |instance| + allow(instance).to receive(:delete_file).and_raise(Gitlab::Git::CommitError, 'Cannot delete file') + end delete api(route(file_path), user), params: params diff --git a/spec/requests/api/graphql_spec.rb b/spec/requests/api/graphql_spec.rb index bfdfd034cca..d0378278600 100644 --- a/spec/requests/api/graphql_spec.rb +++ b/spec/requests/api/graphql_spec.rb @@ -46,7 +46,7 @@ describe 'GraphQL' do end it 'logs the exception in Sentry and continues with the request' do - expect(Gitlab::Sentry).to receive(:track_and_raise_for_dev_exception).at_least(1).times + expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).at_least(1).times expect(Gitlab::GraphqlLogger).to receive(:info) post_graphql(query, variables: {}) @@ -146,7 +146,7 @@ describe 'GraphQL' do end it "logs a warning that the 'calls_gitaly' field declaration is missing" do - expect(Gitlab::Sentry).to receive(:track_and_raise_for_dev_exception).once + expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).once post_graphql(query, current_user: user) end diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index c7b35d6f50d..a4f68df928f 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -1075,8 +1075,9 @@ describe API::Groups do let(:project_path) { CGI.escape(project.full_path) } before do - allow_any_instance_of(Projects::TransferService) - .to receive(:execute).and_return(true) + allow_next_instance_of(Projects::TransferService) do |instance| + allow(instance).to receive(:execute).and_return(true) + end end context "when authenticated as user" do diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb index 1bec860bf0e..26174611c58 100644 --- a/spec/requests/api/helpers_spec.rb +++ b/spec/requests/api/helpers_spec.rb @@ -229,8 +229,8 @@ describe API::Helpers do stub_sentry_settings - expect(Gitlab::Sentry).to receive(:sentry_dsn).and_return(Gitlab.config.sentry.dsn) - Gitlab::Sentry.configure + expect(Gitlab::ErrorTracking).to receive(:sentry_dsn).and_return(Gitlab.config.sentry.dsn) + Gitlab::ErrorTracking.configure Raven.client.configuration.encoding = 'json' end diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index 020e7659a4c..82bf607b911 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -795,9 +795,11 @@ describe API::Jobs do before do stub_remote_url_206(url, file_path) - allow_any_instance_of(JobArtifactUploader).to receive(:file_storage?) { false } - allow_any_instance_of(JobArtifactUploader).to receive(:url) { url } - allow_any_instance_of(JobArtifactUploader).to receive(:size) { File.size(file_path) } + allow_next_instance_of(JobArtifactUploader) do |instance| + allow(instance).to receive(:file_storage?) { false } + allow(instance).to receive(:url) { url } + allow(instance).to receive(:size) { File.size(file_path) } + end end it 'returns specific job trace' do diff --git a/spec/requests/api/project_snippets_spec.rb b/spec/requests/api/project_snippets_spec.rb index cac3f07d0d0..bfb6f10efa3 100644 --- a/spec/requests/api/project_snippets_spec.rb +++ b/spec/requests/api/project_snippets_spec.rb @@ -179,7 +179,9 @@ describe API::ProjectSnippets do end before do - allow_any_instance_of(AkismetService).to receive(:spam?).and_return(true) + allow_next_instance_of(AkismetService) do |instance| + allow(instance).to receive(:spam?).and_return(true) + end end context 'when the snippet is private' do @@ -269,7 +271,9 @@ describe API::ProjectSnippets do end before do - allow_any_instance_of(AkismetService).to receive(:spam?).and_return(true) + allow_next_instance_of(AkismetService) do |instance| + allow(instance).to receive(:spam?).and_return(true) + end end context 'when the snippet is private' do diff --git a/spec/requests/api/snippets_spec.rb b/spec/requests/api/snippets_spec.rb index 29ef040ee2e..eb9d0d38bcb 100644 --- a/spec/requests/api/snippets_spec.rb +++ b/spec/requests/api/snippets_spec.rb @@ -238,7 +238,9 @@ describe API::Snippets do end before do - allow_any_instance_of(AkismetService).to receive(:spam?).and_return(true) + allow_next_instance_of(AkismetService) do |instance| + allow(instance).to receive(:spam?).and_return(true) + end end context 'when the snippet is private' do @@ -325,7 +327,9 @@ describe API::Snippets do end before do - allow_any_instance_of(AkismetService).to receive(:spam?).and_return(true) + allow_next_instance_of(AkismetService) do |instance| + allow(instance).to receive(:spam?).and_return(true) + end end context 'when the snippet is private' do diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb index dca87d5e4ce..09e63b86cfc 100644 --- a/spec/requests/api/tags_spec.rb +++ b/spec/requests/api/tags_spec.rb @@ -328,7 +328,9 @@ describe API::Tags do let(:route) { "/projects/#{project_id}/repository/tags/#{tag_name}" } before do - allow_any_instance_of(Repository).to receive(:rm_tag).and_return(true) + allow_next_instance_of(Repository) do |instance| + allow(instance).to receive(:rm_tag).and_return(true) + end end shared_examples_for 'repository delete tag' do |