fixes for tests

This commit is contained in:
Kyle Drake 2016-05-24 21:44:45 -04:00
parent df78018547
commit 52c488a3d7
3 changed files with 7 additions and 6 deletions

View file

@ -6,14 +6,14 @@ describe 'site/settings' do
before do before do
EmailWorker.jobs.clear EmailWorker.jobs.clear
@email = "#{SecureRandom.uuid.gsub('-', '')}@example.com" @email = "#{SecureRandom.uuid.gsub('-', '')}@exampleedsdfdsf.com"
@site = Fabricate :site, email: @email @site = Fabricate :site, email: @email
page.set_rack_session id: @site.id page.set_rack_session id: @site.id
visit '/settings' visit '/settings'
end end
it 'should change email' do it 'should change email' do
@new_email = "#{SecureRandom.uuid.gsub('-', '')}@example.com" @new_email = "#{SecureRandom.uuid.gsub('-', '')}@exampleedsdfdsf.com"
fill_in 'email', with: @new_email fill_in 'email', with: @new_email
click_button 'Change Email' click_button 'Change Email'
@ -45,7 +45,7 @@ describe 'site/settings' do
end end
it 'should fail for existing email' do it 'should fail for existing email' do
@existing_email = "#{SecureRandom.uuid.gsub('-', '')}@example.com" @existing_email = "#{SecureRandom.uuid.gsub('-', '')}@exampleedsdfdsf.com"
@existing_site = Fabricate :site, email: @existing_email @existing_site = Fabricate :site, email: @existing_email
fill_in 'email', with: @existing_email fill_in 'email', with: @existing_email
@ -77,7 +77,7 @@ describe 'site/settings' do
include Capybara::DSL include Capybara::DSL
before do before do
@email = "#{SecureRandom.uuid.gsub('-', '')}@example.com" @email = "#{SecureRandom.uuid.gsub('-', '')}@exampleedsdfdsf.com"
@site = Fabricate :site, email: @email @site = Fabricate :site, email: @email
EmailWorker.jobs.clear EmailWorker.jobs.clear
Mail::TestMailer.deliveries.clear Mail::TestMailer.deliveries.clear

View file

@ -58,7 +58,8 @@ describe 'signup' do
page.must_have_content /almost ready!/ page.must_have_content /almost ready!/
fill_in 'token', with: Site[username: @site[:username]].email_confirmation_token fill_in 'token', with: Site[username: @site[:username]].email_confirmation_token
click_button 'Confirm Email' click_button 'Confirm Email'
page.must_have_content /Thanks for joining the Neocities community/ current_path.must_equal '/tutorial'
page.must_have_content /Let's Get Started/
index_file_path = File.join Site::SITE_FILES_ROOT, @site[:username], 'index.html' index_file_path = File.join Site::SITE_FILES_ROOT, @site[:username], 'index.html'
File.exist?(index_file_path).must_equal true File.exist?(index_file_path).must_equal true

View file

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