diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-07-23 07:34:54 +0300 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2018-07-23 07:34:54 +0300 |
commit | ddd2a25679f1d875332f603f115e25577b05a5a2 (patch) | |
tree | 2fb343f92c44755dae2294d9a9d0013045c5501a /spec/requests/api/users_spec.rb | |
parent | dc7b4b7bb97ead6fca1eefad5f56c8db5db00f93 (diff) |
Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs'
`perform_enqueued_jobs` is a Sidekiq method.
Using this method violates the Dependency inversion principle[0].
This commit replaces `perform_enqueued_jobs` with ActiveJob's abstract
method `perform_enqueued_jobs` in specs.
[0]: https://en.wikipedia.org/wiki/Dependency_inversion_principle
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r-- | spec/requests/api/users_spec.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index a97c3f3461a..b3079c0a77b 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -1067,7 +1067,7 @@ describe API::Users do end it "deletes user" do - Sidekiq::Testing.inline! { delete api("/users/#{user.id}", admin) } + perform_enqueued_jobs { delete api("/users/#{user.id}", admin) } expect(response).to have_gitlab_http_status(204) expect { User.find(user.id) }.to raise_error ActiveRecord::RecordNotFound @@ -1079,30 +1079,30 @@ describe API::Users do end it "does not delete for unauthenticated user" do - Sidekiq::Testing.inline! { delete api("/users/#{user.id}") } + perform_enqueued_jobs { delete api("/users/#{user.id}") } expect(response).to have_gitlab_http_status(401) end it "is not available for non admin users" do - Sidekiq::Testing.inline! { delete api("/users/#{user.id}", user) } + perform_enqueued_jobs { delete api("/users/#{user.id}", user) } expect(response).to have_gitlab_http_status(403) end it "returns 404 for non-existing user" do - Sidekiq::Testing.inline! { delete api("/users/999999", admin) } + perform_enqueued_jobs { delete api("/users/999999", admin) } expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 User Not Found') end it "returns a 404 for invalid ID" do - Sidekiq::Testing.inline! { delete api("/users/ASDF", admin) } + perform_enqueued_jobs { delete api("/users/ASDF", admin) } expect(response).to have_gitlab_http_status(404) end context "hard delete disabled" do it "moves contributions to the ghost user" do - Sidekiq::Testing.inline! { delete api("/users/#{user.id}", admin) } + perform_enqueued_jobs { delete api("/users/#{user.id}", admin) } expect(response).to have_gitlab_http_status(204) expect(issue.reload).to be_persisted @@ -1112,7 +1112,7 @@ describe API::Users do context "hard delete enabled" do it "removes contributions" do - Sidekiq::Testing.inline! { delete api("/users/#{user.id}?hard_delete=true", admin) } + perform_enqueued_jobs { delete api("/users/#{user.id}?hard_delete=true", admin) } expect(response).to have_gitlab_http_status(204) expect(Issue.exists?(issue.id)).to be_falsy |