diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb deleted file mode 100644 index 36fa10f..0000000 --- a/app/controllers/contacts_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class ContactsController < ContactUs::ContactsController - respond_to :html - - ## - # create - # - # POST - Create a Contact Request - def create - @contact = ContactUs::Contact.new(params[:contact_us_contact]) - if (!user_signed_in?) - if verify_recaptcha(message: "You have not added the validation words correctly") && @contact.save - flash[:notice] = t('contact_us.notices.success') - redirect_to(root_path) - else # recaptcha invalid or contact failed to save - flash[:alert] = t('contact_us.notices.error') - render_new_page - end - else # no user signed in - if @contact.save - flash[:notice] = t('contact_us.notices.success') - redirect_to :controller => 'projects', :action => 'index' - else # contact failed to save - flash[:alert] = t('contact_us.notices.error') - render_new_page - end - end - end -end \ No newline at end of file diff --git a/test/functional/confirmations_controller_test.rb b/test/functional/confirmations_controller_test.rb new file mode 100644 index 0000000..7f870e3 --- /dev/null +++ b/test/functional/confirmations_controller_test.rb @@ -0,0 +1,32 @@ +class ConfirmationsControllerTest < ActionDispatch::IntegrationTest + + include Devise::Test::IntegrationHelpers + + test 'make sure the user is redirected to the home page after confirming their email address' do + @user = User.first + @user.confirmed_at = nil + @user.confirmation_token = 'ABCD1234' + @user.confirmation_sent_at = Time.now + @user.save! + + # Make sure invalid token results in + get "#{root_url}/users/confirmation?confirmation_token=ZXYW0987" + assert_response :success + assert_select '.main_page_content h2', _('Resend confirmation instructions') + + get "#{root_url}/users/confirmation?confirmation_token=ABCD1234" + assert_response :redirect + assert_redirected_to root_url + follow_redirects + assert_select '.main_page_content h2', _('Welcome.') + @user.reload + assert_not @user.confirmed_at.nil?, "Expected the confirmed_at value to have been set!" + + # Make sure that we cannot reconfirm again + get "#{root_url}/users/confirmation?confirmation_token=ABCD1234" + assert_response :success + assert_select '.main_page_content h2', _('Resend confirmation instructions') + + end + +end \ No newline at end of file