profile scaffold
This commit is contained in:
parent
2709842d4d
commit
35f33e8215
16
app/controllers/admin/profile_controller.rb
Normal file
16
app/controllers/admin/profile_controller.rb
Normal 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
|
2
app/views/admin/profile/edit.html.erb
Normal file
2
app/views/admin/profile/edit.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>Admin::Profile#edit</h1>
|
||||
<p>Find me in app/views/admin/profile/edit.html.erb</p>
|
2
app/views/admin/profile/lost_password.html.erb
Normal file
2
app/views/admin/profile/lost_password.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>Admin::Profile#lost_password</h1>
|
||||
<p>Find me in app/views/admin/profile/lost_password.html.erb</p>
|
2
app/views/admin/profile/view.html.erb
Normal file
2
app/views/admin/profile/view.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>Admin::Profile#view</h1>
|
||||
<p>Find me in app/views/admin/profile/view.html.erb</p>
|
@ -3,8 +3,6 @@ Rails.application.routes.draw do
|
||||
get "/admin/login", to: "admin/auth#login", as: :admin_login
|
||||
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/quiz/new", to: "admin/quiz#new", as: :admin_new_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
|
||||
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
|
||||
|
30
test/controllers/admin/profile_controller_test.rb
Normal file
30
test/controllers/admin/profile_controller_test.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user