fix specs

This commit is contained in:
James Lopez 2017-09-20 13:36:00 +02:00
parent faa95ba4fb
commit f2e9ef1027
3 changed files with 6 additions and 6 deletions

View file

@ -4,7 +4,7 @@ describe Emails::CreateService do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:opts) { { email: 'new@email.com' } } let(:opts) { { email: 'new@email.com' } }
subject(:service) { described_class.new(user, opts) } subject(:service) { described_class.new(user, user, opts) }
describe '#execute' do describe '#execute' do
it 'creates an email with valid attributes' do it 'creates an email with valid attributes' do

View file

@ -4,7 +4,7 @@ describe Emails::DestroyService do
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:email) { create(:email, user: user) } let!(:email) { create(:email, user: user) }
subject(:service) { described_class.new(user, email: email.email) } subject(:service) { described_class.new(user, user, email: email.email) }
describe '#execute' do describe '#execute' do
it 'removes an email' do it 'removes an email' do

View file

@ -31,13 +31,13 @@ describe Users::UpdateService do
end end
def update_user(user, opts) def update_user(user, opts)
described_class.new(user, opts).execute described_class.new(user, user, opts).execute
end end
end end
describe '#execute!' do describe '#execute!' do
it 'updates the name' do it 'updates the name' do
service = described_class.new(user, name: 'New Name') service = described_class.new(user, user, name: 'New Name')
expect(service).not_to receive(:notify_new_user) expect(service).not_to receive(:notify_new_user)
result = service.execute! result = service.execute!
@ -55,7 +55,7 @@ describe Users::UpdateService do
it 'fires system hooks when a new user is saved' do it 'fires system hooks when a new user is saved' do
system_hook_service = spy(:system_hook_service) system_hook_service = spy(:system_hook_service)
user = build(:user) user = build(:user)
service = described_class.new(user, name: 'John Doe') service = described_class.new(user, user, name: 'John Doe')
expect(service).to receive(:notify_new_user).and_call_original expect(service).to receive(:notify_new_user).and_call_original
expect(service).to receive(:system_hook_service).and_return(system_hook_service) expect(service).to receive(:system_hook_service).and_return(system_hook_service)
@ -65,7 +65,7 @@ describe Users::UpdateService do
end end
def update_user(user, opts) def update_user(user, opts)
described_class.new(user, opts).execute! described_class.new(user, user, opts).execute!
end end
end end
end end