2017-06-16 08:07:56 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Emails::DestroyService do
|
2017-06-16 08:07:56 -04:00
|
|
|
let!(:user) { create(:user) }
|
|
|
|
let!(:email) { create(:email, user: user) }
|
|
|
|
|
2017-10-05 06:48:22 -04:00
|
|
|
subject(:service) { described_class.new(user, user: user) }
|
2017-06-16 08:07:56 -04:00
|
|
|
|
|
|
|
describe '#execute' do
|
2017-06-16 08:30:29 -04:00
|
|
|
it 'removes an email' do
|
2017-09-12 11:36:59 -04:00
|
|
|
expect { service.execute(email) }.to change { user.emails.count }.by(-1)
|
2017-06-16 08:07:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|