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-06-23 13:00:22 -04:00
|
|
|
subject(:service) { described_class.new(user, email: email.email) }
|
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-06-16 08:07:56 -04:00
|
|
|
expect { service.execute }.to change { user.emails.count }.by(-1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|