2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe DeleteUserWorker do
|
2016-06-02 11:05:42 +05:30
|
|
|
let!(:user) { create(:user) }
|
|
|
|
let!(:current_user) { create(:user) }
|
|
|
|
|
|
|
|
it "calls the DeleteUserWorker with the params it was given" do
|
2018-11-08 19:23:39 +05:30
|
|
|
expect_next_instance_of(Users::DestroyService) do |service|
|
|
|
|
expect(service).to receive(:execute).with(user, {})
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
described_class.new.perform(current_user.id, user.id)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it "uses symbolized keys" do
|
2018-11-08 19:23:39 +05:30
|
|
|
expect_next_instance_of(Users::DestroyService) do |service|
|
2022-07-16 23:28:13 +05:30
|
|
|
expect(service).to receive(:execute).with(user, { test: "test" })
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
described_class.new.perform(current_user.id, user.id, { "test" => "test" })
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|