diff --git a/app/controllers/admin/profile_controller.rb b/app/controllers/admin/profile_controller.rb new file mode 100644 index 0000000..eb22f66 --- /dev/null +++ b/app/controllers/admin/profile_controller.rb @@ -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 diff --git a/app/views/admin/profile/edit.html.erb b/app/views/admin/profile/edit.html.erb new file mode 100644 index 0000000..cbb5227 --- /dev/null +++ b/app/views/admin/profile/edit.html.erb @@ -0,0 +1,2 @@ +
Find me in app/views/admin/profile/edit.html.erb
diff --git a/app/views/admin/profile/lost_password.html.erb b/app/views/admin/profile/lost_password.html.erb new file mode 100644 index 0000000..2570697 --- /dev/null +++ b/app/views/admin/profile/lost_password.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/admin/profile/lost_password.html.erb
diff --git a/app/views/admin/profile/view.html.erb b/app/views/admin/profile/view.html.erb new file mode 100644 index 0000000..492c480 --- /dev/null +++ b/app/views/admin/profile/view.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/admin/profile/view.html.erb
diff --git a/config/routes.rb b/config/routes.rb index c78aa34..7a07a31 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/test/controllers/admin/profile_controller_test.rb b/test/controllers/admin/profile_controller_test.rb new file mode 100644 index 0000000..a60604e --- /dev/null +++ b/test/controllers/admin/profile_controller_test.rb @@ -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