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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
3798e894
Commit
3798e894
authored
Jun 16, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add emails service specs
parent
158550cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
spec/services/emails/create_service_spec.rb
spec/services/emails/create_service_spec.rb
+21
-0
spec/services/emails/destroy_service_spec.rb
spec/services/emails/destroy_service_spec.rb
+14
-0
No files found.
spec/services/emails/create_service_spec.rb
0 → 100644
View file @
3798e894
require
'spec_helper'
describe
Emails
::
CreateService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:opts
)
{
{
email:
'new@email.com'
}
}
subject
(
:service
)
{
described_class
.
new
(
user
,
opts
)
}
describe
'#execute'
do
it
'creates an email with valid attributes'
do
expect
{
service
.
execute
}.
to
change
{
Email
.
count
}.
by
(
1
)
expect
(
Email
.
where
(
opts
)).
not_to
be_empty
end
it
'has the right user association'
do
service
.
execute
expect
(
user
.
emails
).
to
eq
(
Email
.
where
(
opts
))
end
end
end
spec/services/emails/destroy_service_spec.rb
0 → 100644
View file @
3798e894
require
'spec_helper'
describe
Emails
::
DestroyService
,
services:
true
do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:email
)
{
create
(
:email
,
user:
user
)
}
subject
(
:service
)
{
described_class
.
new
(
user
,
opts
)
}
describe
'#execute'
do
it
'creates an email with valid attributes'
do
expect
{
service
.
execute
}.
to
change
{
user
.
emails
.
count
}.
by
(
-
1
)
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