2020-03-07 06:48:16 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe User do
|
|
|
|
let!(:account_user) { create(:account_user) }
|
2021-02-15 08:02:52 +00:00
|
|
|
let(:agent_destroy_service) { double }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(Agents::DestroyService).to receive(:new).and_return(agent_destroy_service)
|
|
|
|
allow(agent_destroy_service).to receive(:perform).and_return(agent_destroy_service)
|
|
|
|
end
|
2020-03-07 06:48:16 +00:00
|
|
|
|
|
|
|
describe 'notification_settings' do
|
|
|
|
it 'gets created with the right default settings' do
|
|
|
|
expect(account_user.user.notification_settings).not_to eq(nil)
|
|
|
|
|
2020-05-01 09:23:43 +00:00
|
|
|
expect(account_user.user.notification_settings.first.email_conversation_creation?).to eq(false)
|
|
|
|
expect(account_user.user.notification_settings.first.email_conversation_assignment?).to eq(true)
|
2020-03-07 06:48:16 +00:00
|
|
|
end
|
|
|
|
end
|
2021-02-15 08:02:52 +00:00
|
|
|
|
|
|
|
describe 'destroy call agent::destroy service' do
|
|
|
|
it 'gets created with the right default settings' do
|
|
|
|
user = account_user.user
|
|
|
|
account = account_user.account
|
|
|
|
account_user.destroy!
|
|
|
|
expect(Agents::DestroyService).to have_received(:new).with({
|
|
|
|
user: user, account: account
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
2020-03-07 06:48:16 +00:00
|
|
|
end
|