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