BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a32f1ddd
Commit
a32f1ddd
authored
Sep 14, 2017
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes for rubocop
parent
a000c2a1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
15 deletions
+12
-15
emails_controller.rb
app/controllers/profiles/emails_controller.rb
+1
-2
create_service.rb
app/services/emails/create_service.rb
+1
-1
emails_controller_spec.rb
spec/controllers/profiles/emails_controller_spec.rb
+2
-2
gpg_key_spec.rb
spec/models/gpg_key_spec.rb
+4
-4
user_spec.rb
spec/models/user_spec.rb
+4
-6
No files found.
app/controllers/profiles/emails_controller.rb
View file @
a32f1ddd
class
Profiles
::
EmailsController
<
Profiles
::
ApplicationController
class
Profiles
::
EmailsController
<
Profiles
::
ApplicationController
before_action
:find_email
,
only:
[
:destroy
,
:resend_confirmation_instructions
]
before_action
:find_email
,
only:
[
:destroy
,
:resend_confirmation_instructions
]
def
index
def
index
...
@@ -39,7 +38,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
...
@@ -39,7 +38,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
def
email_params
def
email_params
params
.
require
(
:email
).
permit
(
:email
)
params
.
require
(
:email
).
permit
(
:email
)
end
end
def
find_email
def
find_email
@email
=
current_user
.
emails
.
find
(
params
[
:id
])
@email
=
current_user
.
emails
.
find
(
params
[
:id
])
end
end
...
...
app/services/emails/create_service.rb
View file @
a32f1ddd
module
Emails
module
Emails
class
CreateService
<
::
Emails
::
BaseService
class
CreateService
<
::
Emails
::
BaseService
def
execute
(
options
=
{})
def
execute
(
options
=
{})
@user
.
emails
.
create
({
email:
@email
}.
merge
(
options
))
@user
.
emails
.
create
({
email:
@email
}.
merge
(
options
))
end
end
end
end
end
end
spec/controllers/profiles/emails_controller_spec.rb
View file @
a32f1ddd
...
@@ -8,7 +8,7 @@ describe Profiles::EmailsController do
...
@@ -8,7 +8,7 @@ describe Profiles::EmailsController do
end
end
describe
'#create'
do
describe
'#create'
do
let
(
:email_params
)
{
{
email:
"add_email@example.com"
}
}
let
(
:email_params
)
{
{
email:
"add_email@example.com"
}
}
it
'sends an email confirmation'
do
it
'sends an email confirmation'
do
expect
{
post
(
:create
,
{
email:
email_params
})}.
to
change
{
ActionMailer
::
Base
.
deliveries
.
size
}
expect
{
post
(
:create
,
{
email:
email_params
})}.
to
change
{
ActionMailer
::
Base
.
deliveries
.
size
}
...
@@ -18,7 +18,7 @@ describe Profiles::EmailsController do
...
@@ -18,7 +18,7 @@ describe Profiles::EmailsController do
end
end
describe
'#resend_confirmation_instructions'
do
describe
'#resend_confirmation_instructions'
do
let
(
:email_params
)
{
{
email:
"add_email@example.com"
}
}
let
(
:email_params
)
{
{
email:
"add_email@example.com"
}
}
it
'resends an email confirmation'
do
it
'resends an email confirmation'
do
email
=
user
.
emails
.
create
(
email:
'add_email@example.com'
)
email
=
user
.
emails
.
create
(
email:
'add_email@example.com'
)
...
...
spec/models/gpg_key_spec.rb
View file @
a32f1ddd
...
@@ -88,17 +88,17 @@ describe GpgKey do
...
@@ -88,17 +88,17 @@ describe GpgKey do
describe
'#emails_with_verified_status'
do
describe
'#emails_with_verified_status'
do
it
'email is verified if the user has the matching email'
do
it
'email is verified if the user has the matching email'
do
user
=
create
:user
,
email:
'bette.cartwright@example.com'
user
=
create
:user
,
email:
'bette.cartwright@example.com'
gpg_key
=
create
:gpg_key
,
key:
GpgHelpers
::
User2
.
public_key
,
user:
user
gpg_key
=
create
:gpg_key
,
key:
GpgHelpers
::
User2
.
public_key
,
user:
user
email_unconfirmed
=
create
:email
,
user:
user
create
:email
,
user:
user
user
.
reload
user
.
reload
expect
(
gpg_key
.
emails_with_verified_status
).
to
eq
(
expect
(
gpg_key
.
emails_with_verified_status
).
to
eq
(
'bette.cartwright@example.com'
=>
true
,
'bette.cartwright@example.com'
=>
true
,
'bette.cartwright@example.net'
=>
false
'bette.cartwright@example.net'
=>
false
)
)
email_confirmed
=
create
:email
,
:confirmed
,
user:
user
,
email:
'bette.cartwright@example.net'
create
:email
,
:confirmed
,
user:
user
,
email:
'bette.cartwright@example.net'
user
.
reload
user
.
reload
expect
(
gpg_key
.
emails_with_verified_status
).
to
eq
(
expect
(
gpg_key
.
emails_with_verified_status
).
to
eq
(
'bette.cartwright@example.com'
=>
true
,
'bette.cartwright@example.com'
=>
true
,
...
...
spec/models/user_spec.rb
View file @
a32f1ddd
...
@@ -409,14 +409,12 @@ describe User do
...
@@ -409,14 +409,12 @@ describe User do
end
end
it
'transfers old confirmation values into new secondary'
do
it
'transfers old confirmation values into new secondary'
do
org_user
=
@user
@user
.
update_attributes!
(
email:
@secondary
.
email
)
@user
.
update_attributes!
(
email:
@secondary
.
email
)
@user
.
reload
@user
.
reload
expect
(
@user
.
emails
.
count
).
to
eq
1
expect
(
@user
.
emails
.
count
).
to
eq
1
expect
(
@user
.
emails
.
first
.
confirmed_at
).
not_to
eq
nil
expect
(
@user
.
emails
.
first
.
confirmed_at
).
not_to
eq
nil
end
end
end
end
end
end
describe
'#update_tracked_fields!'
,
:clean_gitlab_redis_shared_state
do
describe
'#update_tracked_fields!'
,
:clean_gitlab_redis_shared_state
do
...
@@ -1146,8 +1144,8 @@ describe User do
...
@@ -1146,8 +1144,8 @@ describe User do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
it
'returns only confirmed emails'
do
it
'returns only confirmed emails'
do
email_confirmed
=
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
email_confirmed
=
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
email_unconfirmed
=
create
:email
,
user:
user
create
:email
,
user:
user
user
.
reload
user
.
reload
expect
(
user
.
verified_emails
).
to
match_array
([
user
.
email
,
email_confirmed
.
email
])
expect
(
user
.
verified_emails
).
to
match_array
([
user
.
email
,
email_confirmed
.
email
])
end
end
...
@@ -1157,8 +1155,8 @@ describe User do
...
@@ -1157,8 +1155,8 @@ describe User do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
it
'returns true when the email is verified/confirmed'
do
it
'returns true when the email is verified/confirmed'
do
email_confirmed
=
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
email_confirmed
=
create
:email
,
user:
user
,
confirmed_at:
Time
.
now
email_unconfirmed
=
create
:email
,
user:
user
create
:email
,
user:
user
user
.
reload
user
.
reload
expect
(
user
.
verified_email?
(
user
.
email
)).
to
be_truthy
expect
(
user
.
verified_email?
(
user
.
email
)).
to
be_truthy
...
...
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