2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Emails::DestroyService do
|
|
|
|
let!(:user) { create(:user) }
|
|
|
|
let!(:email) { create(:email, user: user) }
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
subject(:service) { described_class.new(user, user: user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
describe '#execute' do
|
|
|
|
it 'removes an email' do
|
2018-03-17 18:26:18 +05:30
|
|
|
expect { service.execute(email) }.to change { user.emails.count }.by(-1)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|