Merge branch 'emailvalidation'

This commit is contained in:
Kyle Drake 2016-05-14 23:21:22 -04:00
commit 6b88c8339d
19 changed files with 181 additions and 28 deletions

View file

@ -16,7 +16,14 @@ describe 'site/settings' do
@new_email = "#{SecureRandom.uuid.gsub('-', '')}@example.com"
fill_in 'email', with: @new_email
click_button 'Change Email'
page.must_have_content /successfully changed email/i
page.must_have_content /enter the confirmation code here/
fill_in 'token', with: @site.reload.email_confirmation_token
click_button 'Confirm Email'
page.must_have_content /Email address changed/i
@site.reload
@site.email.must_equal @new_email
EmailWorker.jobs.length.must_equal 1

View file

@ -345,13 +345,11 @@ describe 'delete' do
owned_site = Fabricate :site, parent_site_id: @site.id
visit "/settings/#{owned_site.username}#delete"
fill_in 'confirm_username', with: owned_site.username
fill_in 'deleted_reason', with: 'got bored with it'
click_button 'Delete Site'
@site.reload
owned_site.reload
owned_site.is_deleted.must_equal true
owned_site.deleted_reason.must_equal 'got bored with it'
@site.is_deleted.must_equal false
page.current_path.must_equal "/settings"

View file

@ -54,6 +54,12 @@ describe 'signup' do
click_signup_button
site_created?
click_link 'Continue'
page.must_have_content /almost ready!/
fill_in 'token', with: Site[username: @site[:username]].email_confirmation_token
click_button 'Confirm Email'
page.must_have_content /Thanks for joining the Neocities community/
index_file_path = File.join Site::SITE_FILES_ROOT, @site[:username], 'index.html'
File.exist?(index_file_path).must_equal true

View file

@ -1,5 +1,6 @@
Fabricator(:site) do
username { SecureRandom.hex }
password { 'abcde' }
email { SecureRandom.uuid.gsub('-', '')+'@example.com' }
end
username { SecureRandom.hex }
password { 'abcde' }
email { SecureRandom.uuid.gsub('-', '')+'@example.com' }
email_confirmed { true }
end