Commit d2267beb authored by Brett Walker's avatar Brett Walker

tweaks for rubocop

parent cf8a5bca
...@@ -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
......
...@@ -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
...@@ -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
...@@ -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
......
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
...@@ -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
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment