2019-03-30 03:15:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-02-17 08:41:33 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe DeleteUserWorker do
|
2016-03-14 06:18:03 -04:00
|
|
|
let!(:user) { create(:user) }
|
|
|
|
let!(:current_user) { create(:user) }
|
2016-02-17 08:41:33 -05:00
|
|
|
|
2016-03-14 06:18:03 -04:00
|
|
|
it "calls the DeleteUserWorker with the params it was given" do
|
2018-06-25 08:28:49 -04:00
|
|
|
expect_next_instance_of(Users::DestroyService) do |service|
|
|
|
|
expect(service).to receive(:execute).with(user, {})
|
|
|
|
end
|
2016-03-04 03:49:23 -05:00
|
|
|
|
2017-05-01 11:13:33 -04:00
|
|
|
described_class.new.perform(current_user.id, user.id)
|
2016-03-14 06:18:03 -04:00
|
|
|
end
|
2016-03-04 03:49:23 -05:00
|
|
|
|
2016-03-14 06:18:03 -04:00
|
|
|
it "uses symbolized keys" do
|
2018-06-25 08:28:49 -04:00
|
|
|
expect_next_instance_of(Users::DestroyService) do |service|
|
|
|
|
expect(service).to receive(:execute).with(user, test: "test")
|
|
|
|
end
|
2016-03-04 03:49:23 -05:00
|
|
|
|
2017-05-01 11:13:33 -04:00
|
|
|
described_class.new.perform(current_user.id, user.id, "test" => "test")
|
2016-02-17 08:41:33 -05:00
|
|
|
end
|
|
|
|
end
|