2019-05-18 00:54:41 +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|
|
|
|
|
expect(service).to receive(:execute).with(user, test: "test")
|
|
|
|
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, "test" => "test")
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|