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
d2267beb
Commit
d2267beb
authored
Sep 09, 2017
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaks for rubocop
parent
cf8a5bca
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
15 deletions
+14
-15
emails_controller.rb
app/controllers/profiles/emails_controller.rb
+1
-1
20170904092148_add_email_confirmation.rb
db/migrate/20170904092148_add_email_confirmation.rb
+2
-2
20170909090114_add_email_confirmation_index.rb
db/migrate/20170909090114_add_email_confirmation_index.rb
+1
-1
path_regex.rb
lib/gitlab/path_regex.rb
+1
-0
emails_controller_spec.rb
spec/controllers/profiles/emails_controller_spec.rb
+3
-4
emails_spec.rb
spec/features/profiles/emails_spec.rb
+5
-6
confirm_service_spec.rb
spec/services/emails/confirm_service_spec.rb
+1
-1
No files found.
app/controllers/profiles/emails_controller.rb
View file @
d2267beb
...
...
@@ -33,7 +33,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
end
redirect_to
profile_emails_url
end
private
def
email_params
...
...
db/migrate/20170904092148_add_email_confirmation.rb
View file @
d2267beb
...
...
@@ -27,7 +27,7 @@ class AddEmailConfirmation < ActiveRecord::Migration
def
change
add_column
:emails
,
:confirmation_token
,
:string
add_column
:emails
,
:confirmed_at
,
:datetime
add_column
:emails
,
:confirmation_sent_at
,
:datetime
add_column
:emails
,
:confirmed_at
,
:datetime
_with_timezone
add_column
:emails
,
:confirmation_sent_at
,
:datetime
_with_timezone
end
end
db/migrate/20170909090114_add_email_confirmation_index.rb
View file @
d2267beb
...
...
@@ -31,6 +31,6 @@ class AddEmailConfirmationIndex < ActiveRecord::Migration
end
def
down
remove_index
:emails
,
:confirmation_token
if
index_exists?
(
:emails
,
:confirmation_token
)
remove_
concurrent_
index
:emails
,
:confirmation_token
if
index_exists?
(
:emails
,
:confirmation_token
)
end
end
lib/gitlab/path_regex.rb
View file @
d2267beb
...
...
@@ -30,6 +30,7 @@ module Gitlab
ci
dashboard
deploy.html
emails
explore
favicon.ico
files
...
...
spec/controllers/profiles/emails_controller_spec.rb
View file @
d2267beb
require
'spec_helper'
describe
Profiles
::
EmailsController
do
let
(
:user
)
{
create
(
:user
)
}
before
do
...
...
@@ -9,7 +8,7 @@ describe Profiles::EmailsController do
end
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
expect
{
post
(
:create
,
{
email:
email_params
})}.
to
change
{
ActionMailer
::
Base
.
deliveries
.
size
}
...
...
@@ -19,7 +18,7 @@ describe Profiles::EmailsController do
end
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
email
=
user
.
emails
.
create
(
email:
'add_email@example.com'
)
...
...
@@ -29,7 +28,7 @@ describe Profiles::EmailsController do
end
it
'unable to resend an email confirmation'
do
expect
{
put
(
:resend_confirmation_instructions
,
{
id:
1
})}.
to_not
change
{
ActionMailer
::
Base
.
deliveries
.
size
}
expect
{
put
(
:resend_confirmation_instructions
,
{
id:
1
})}.
not_to
change
{
ActionMailer
::
Base
.
deliveries
.
size
}
end
end
end
spec/features/profiles/emails_spec.rb
View file @
d2267beb
...
...
@@ -37,7 +37,7 @@ feature 'Profile > Emails' do
expect
(
page
).
to
have_content
(
"my@email.com"
)
click_link
(
'Remove'
)
expect
(
page
).
to_not
have_content
(
"my@email.com"
)
expect
(
page
).
not_to
have_content
(
"my@email.com"
)
end
scenario
'User confirms email'
do
...
...
@@ -51,22 +51,21 @@ feature 'Profile > Emails' do
visit
profile_emails_path
expect
(
page
).
to
have_content
(
"
#{
email
.
email
}
Verified"
)
end
scenario
'User re-sends confirmation email'
do
email
=
user
.
emails
.
create
(
email:
'my@email.com'
)
visit
profile_emails_path
expect
{
click_link
(
"Resend confirmation email"
)
}.
to
change
{
ActionMailer
::
Base
.
deliveries
.
size
}
expect
(
page
).
to
have_content
(
"Confirmation email sent to
#{
email
.
email
}
"
)
end
scenario
'old unconfirmed emails show Send Confirmation button'
do
email
=
user
.
emails
.
create
(
email:
'my@email.com'
)
email
.
update_attribute
(
:confirmation_sent_at
,
nil
)
visit
profile_emails_path
expect
(
page
).
to_not
have_content
(
'Resend confirmation email'
)
expect
(
page
).
not_to
have_content
(
'Resend confirmation email'
)
expect
(
page
).
to
have_content
(
'Send confirmation email'
)
end
end
spec/services/emails/confirm_service_spec.rb
View file @
d2267beb
...
...
@@ -8,7 +8,7 @@ describe Emails::ConfirmService do
describe
'#execute'
do
it
'sends a confirmation email again'
do
email
=
user
.
emails
.
create
(
email:
opts
[
:email
])
user
.
emails
.
create
(
email:
opts
[
:email
])
mail
=
service
.
execute
expect
(
mail
.
subject
).
to
eq
(
'Confirmation instructions'
)
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