Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
defa48ea
Commit
defa48ea
authored
Jul 03, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update services and specs
parent
3a1ff1e3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
7 deletions
+13
-7
app/services/emails/base_service.rb
app/services/emails/base_service.rb
+2
-1
app/services/emails/destroy_service.rb
app/services/emails/destroy_service.rb
+1
-1
app/services/users/update_service.rb
app/services/users/update_service.rb
+6
-1
spec/services/emails/create_service_spec.rb
spec/services/emails/create_service_spec.rb
+1
-1
spec/services/emails/destroy_service_spec.rb
spec/services/emails/destroy_service_spec.rb
+1
-1
spec/services/users/update_service_spec.rb
spec/services/users/update_service_spec.rb
+2
-2
No files found.
app/services/emails/base_service.rb
View file @
defa48ea
module
Emails
module
Emails
class
BaseService
class
BaseService
def
initialize
(
user
,
opts
)
def
initialize
(
current_user
,
user
,
opts
)
@current_user
=
current_user
@user
=
user
@user
=
user
@email
=
opts
[
:email
]
@email
=
opts
[
:email
]
end
end
...
...
app/services/emails/destroy_service.rb
View file @
defa48ea
...
@@ -7,7 +7,7 @@ module Emails
...
@@ -7,7 +7,7 @@ module Emails
private
private
def
update_secondary_emails!
def
update_secondary_emails!
result
=
::
Users
::
UpdateService
.
new
(
@user
).
execute
do
|
user
|
result
=
::
Users
::
UpdateService
.
new
(
@
current_user
,
@
user
).
execute
do
|
user
|
user
.
update_secondary_emails!
user
.
update_secondary_emails!
end
end
...
...
app/services/users/update_service.rb
View file @
defa48ea
...
@@ -2,7 +2,8 @@ module Users
...
@@ -2,7 +2,8 @@ module Users
class
UpdateService
<
BaseService
class
UpdateService
<
BaseService
include
NewUserNotifier
include
NewUserNotifier
def
initialize
(
user
,
params
=
{})
def
initialize
(
current_user
,
user
,
params
=
{})
@current_user
=
current_user
@user
=
user
@user
=
user
@params
=
params
.
dup
@params
=
params
.
dup
end
end
...
@@ -40,5 +41,9 @@ module Users
...
@@ -40,5 +41,9 @@ module Users
@user
.
assign_attributes
(
params
)
if
params
.
any?
@user
.
assign_attributes
(
params
)
if
params
.
any?
end
end
def
model
@user
end
end
end
end
end
spec/services/emails/create_service_spec.rb
View file @
defa48ea
...
@@ -4,7 +4,7 @@ describe Emails::CreateService do
...
@@ -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
...
...
spec/services/emails/destroy_service_spec.rb
View file @
defa48ea
...
@@ -4,7 +4,7 @@ describe Emails::DestroyService do
...
@@ -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
...
...
spec/services/users/update_service_spec.rb
View file @
defa48ea
...
@@ -31,7 +31,7 @@ describe Users::UpdateService do
...
@@ -31,7 +31,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
...
@@ -65,7 +65,7 @@ describe Users::UpdateService do
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment