profile scaffold

This commit is contained in:
Mark Moser 2016-08-24 10:43:33 -05:00
parent 2709842d4d
commit 35f33e8215
6 changed files with 59 additions and 2 deletions

View File

@ -0,0 +1,16 @@
module Admin
class ProfileController < ApplicationController
def view
end
def edit
end
def update
redirect_to admin_profile_path
end
def lost_password
end
end
end

View File

@ -0,0 +1,2 @@
<h1>Admin::Profile#edit</h1>
<p>Find me in app/views/admin/profile/edit.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Profile#lost_password</h1>
<p>Find me in app/views/admin/profile/lost_password.html.erb</p>

View File

@ -0,0 +1,2 @@
<h1>Admin::Profile#view</h1>
<p>Find me in app/views/admin/profile/view.html.erb</p>

View File

@ -3,8 +3,6 @@ Rails.application.routes.draw do
get "/admin/login", to: "admin/auth#login", as: :admin_login get "/admin/login", to: "admin/auth#login", as: :admin_login
get "/admin/logout", to: "admin/auth#logout", as: :admin_logout get "/admin/logout", to: "admin/auth#logout", as: :admin_logout
get "/admin", to: "admin#dashboard", as: :admin
get "/admin/quizzes", to: "admin/quiz#index", as: :admin_quizzes get "/admin/quizzes", to: "admin/quiz#index", as: :admin_quizzes
get "/admin/quiz/new", to: "admin/quiz#new", as: :admin_new_quiz get "/admin/quiz/new", to: "admin/quiz#new", as: :admin_new_quiz
post "/admin/quiz/new", to: "admin/quiz#create", as: :admin_create_quiz post "/admin/quiz/new", to: "admin/quiz#create", as: :admin_create_quiz
@ -30,6 +28,13 @@ Rails.application.routes.draw do
post "/admin/question/:question_id/edit", to: "admin/question#update", as: :admin_update_question post "/admin/question/:question_id/edit", to: "admin/question#update", as: :admin_update_question
patch "/admin/question/:question_id/edit", to: "admin/question#update" patch "/admin/question/:question_id/edit", to: "admin/question#update"
get "/admin/profile", to: "admin/profile#view", as: :admin_profile
post "/admin/profile", to: "admin/profile#update", as: :admin_update_profile
get "/admin/profile/edit", to: "admin/profile#edit", as: :admin_edit_profile
get "/admin/profile/reset", to: "admin/profile#lost_password", as: :admin_reset_password
get "/admin", to: "admin#dashboard", as: :admin
######################################################################################### #########################################################################################
post "/validate", to: "candidate#validate", as: :validate_candidate post "/validate", to: "candidate#validate", as: :validate_candidate

View File

@ -0,0 +1,30 @@
require 'test_helper'
module Admin
class ProfileControllerTest < ActionDispatch::IntegrationTest
def setup
post admin_auth_url, params: { auth:
{ email: 'alan.admin@mailinator.com', password: 'password' } }
end
test "should get view" do
get admin_profile_url
assert_response :success
end
test "should get edit" do
get admin_edit_profile_url
assert_response :success
end
test "should post update" do
post admin_profile_url
assert_redirected_to admin_profile_url
end
test "should get lost_password" do
get admin_reset_password_url
assert_response :success
end
end
end