Commit d2267beb authored by Brett Walker's avatar Brett Walker

tweaks for rubocop

parent cf8a5bca
......@@ -33,7 +33,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
end
redirect_to profile_emails_url
end
private
def email_params
......
......@@ -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
......@@ -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
......@@ -30,6 +30,7 @@ module Gitlab
ci
dashboard
deploy.html
emails
explore
favicon.ico
files
......
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
......@@ -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
......@@ -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
......
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