diff --git a/app/controllers/admin/auth_controller.rb b/app/controllers/admin/auth_controller.rb new file mode 100644 index 0000000..983a370 --- /dev/null +++ b/app/controllers/admin/auth_controller.rb @@ -0,0 +1,12 @@ +module Admin + class AuthController < AdminController + def login + end + + def auth + end + + def logout + end + end +end diff --git a/app/controllers/admin/question_controller.rb b/app/controllers/admin/question_controller.rb new file mode 100644 index 0000000..2d49a92 --- /dev/null +++ b/app/controllers/admin/question_controller.rb @@ -0,0 +1,21 @@ +module Admin + class QuestionController < AdminController + def index + end + + def new + end + + def create + end + + def view + end + + def edit + end + + def update + end + end +end diff --git a/app/controllers/admin/quiz_controller.rb b/app/controllers/admin/quiz_controller.rb new file mode 100644 index 0000000..350a543 --- /dev/null +++ b/app/controllers/admin/quiz_controller.rb @@ -0,0 +1,21 @@ +module Admin + class QuizController < AdminController + def index + end + + def new + end + + def create + end + + def view + end + + def edit + end + + def update + end + end +end diff --git a/app/controllers/admin/user_controller.rb b/app/controllers/admin/user_controller.rb new file mode 100644 index 0000000..59cd2e7 --- /dev/null +++ b/app/controllers/admin/user_controller.rb @@ -0,0 +1,21 @@ +module Admin + class UserController < AdminController + def index + end + + def new + end + + def create + end + + def view + end + + def edit + end + + def update + end + end +end diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb new file mode 100644 index 0000000..69655f9 --- /dev/null +++ b/app/controllers/admin_controller.rb @@ -0,0 +1,2 @@ +class AdminController < ApplicationController +end diff --git a/app/views/admin/auth/login.html.erb b/app/views/admin/auth/login.html.erb new file mode 100644 index 0000000..1aae790 --- /dev/null +++ b/app/views/admin/auth/login.html.erb @@ -0,0 +1,2 @@ +

Admin::Auth#login

+

Find me in app/views/admin/auth/login.html.erb

diff --git a/app/views/admin/auth/logout.html.erb b/app/views/admin/auth/logout.html.erb new file mode 100644 index 0000000..666b438 --- /dev/null +++ b/app/views/admin/auth/logout.html.erb @@ -0,0 +1,2 @@ +

Admin::Auth#logout

+

Find me in app/views/admin/auth/logout.html.erb

diff --git a/app/views/admin/question/edit.html.erb b/app/views/admin/question/edit.html.erb new file mode 100644 index 0000000..34ed55e --- /dev/null +++ b/app/views/admin/question/edit.html.erb @@ -0,0 +1,2 @@ +

Admin::Questions#edit

+

Find me in app/views/admin/questions/edit.html.erb

diff --git a/app/views/admin/question/index.html.erb b/app/views/admin/question/index.html.erb new file mode 100644 index 0000000..dcbca37 --- /dev/null +++ b/app/views/admin/question/index.html.erb @@ -0,0 +1,2 @@ +

Admin::Questions#index

+

Find me in app/views/admin/questions/index.html.erb

diff --git a/app/views/admin/question/new.html.erb b/app/views/admin/question/new.html.erb new file mode 100644 index 0000000..f4507f7 --- /dev/null +++ b/app/views/admin/question/new.html.erb @@ -0,0 +1,2 @@ +

Admin::Questions#new

+

Find me in app/views/admin/questions/new.html.erb

diff --git a/app/views/admin/question/view.html.erb b/app/views/admin/question/view.html.erb new file mode 100644 index 0000000..fea4846 --- /dev/null +++ b/app/views/admin/question/view.html.erb @@ -0,0 +1,2 @@ +

Admin::Questions#view

+

Find me in app/views/admin/questions/view.html.erb

diff --git a/app/views/admin/quiz/edit.html.erb b/app/views/admin/quiz/edit.html.erb new file mode 100644 index 0000000..fc5109e --- /dev/null +++ b/app/views/admin/quiz/edit.html.erb @@ -0,0 +1,2 @@ +

Admin::Quizes#edit

+

Find me in app/views/admin/quizes/edit.html.erb

diff --git a/app/views/admin/quiz/index.html.erb b/app/views/admin/quiz/index.html.erb new file mode 100644 index 0000000..458399a --- /dev/null +++ b/app/views/admin/quiz/index.html.erb @@ -0,0 +1,2 @@ +

Admin::Quizes#index

+

Find me in app/views/admin/quizes/index.html.erb

diff --git a/app/views/admin/quiz/new.html.erb b/app/views/admin/quiz/new.html.erb new file mode 100644 index 0000000..d5bf9bb --- /dev/null +++ b/app/views/admin/quiz/new.html.erb @@ -0,0 +1,2 @@ +

Admin::Quizes#new

+

Find me in app/views/admin/quizes/new.html.erb

diff --git a/app/views/admin/quiz/view.html.erb b/app/views/admin/quiz/view.html.erb new file mode 100644 index 0000000..3df2d04 --- /dev/null +++ b/app/views/admin/quiz/view.html.erb @@ -0,0 +1,2 @@ +

Admin::Quizes#view

+

Find me in app/views/admin/quizes/view.html.erb

diff --git a/app/views/admin/user/edit.html.erb b/app/views/admin/user/edit.html.erb new file mode 100644 index 0000000..363be95 --- /dev/null +++ b/app/views/admin/user/edit.html.erb @@ -0,0 +1,2 @@ +

Admin::Users#edit

+

Find me in app/views/admin/users/edit.html.erb

diff --git a/app/views/admin/user/index.html.erb b/app/views/admin/user/index.html.erb new file mode 100644 index 0000000..30c6fab --- /dev/null +++ b/app/views/admin/user/index.html.erb @@ -0,0 +1,2 @@ +

Admin::Users#index

+

Find me in app/views/admin/users/index.html.erb

diff --git a/app/views/admin/user/new.html.erb b/app/views/admin/user/new.html.erb new file mode 100644 index 0000000..d380347 --- /dev/null +++ b/app/views/admin/user/new.html.erb @@ -0,0 +1,2 @@ +

Admin::Users#new

+

Find me in app/views/admin/users/new.html.erb

diff --git a/app/views/admin/user/view.html.erb b/app/views/admin/user/view.html.erb new file mode 100644 index 0000000..f5453b2 --- /dev/null +++ b/app/views/admin/user/view.html.erb @@ -0,0 +1,2 @@ +

Admin::Users#view

+

Find me in app/views/admin/users/view.html.erb

diff --git a/config/application.rb b/config/application.rb index 4bbbd91..d04f3ab 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,5 +23,11 @@ module SkillAssessmentApp config.action_mailer.delivery_method = :mailjet config.action_mailer.default_url_options = { host: ENV['full_app_url'] } + + config.generators do |g| + g.assets false + g.helper false + g.routes false + end end end diff --git a/config/routes.rb b/config/routes.rb index b245523..c19ff37 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,31 @@ Rails.application.routes.draw do + post "/admin/login", to: "admin/auth#auth", as: :admin_auth + get "/admin/logout", to: "admin/auth#logout", as: :admin_logout + get "/admin", to: "admin/auth#login", 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/create", to: "admin/quiz#create", as: :admin_create_quiz + get "/admin/quiz/:quiz_id", to: "admin/quiz#view", as: :admin_quiz + get "/admin/quiz/:quiz_id/edit", to: "admin/quiz#edit", as: :admin_edit_quiz + post "/admin/quiz/:quiz_id/update", to: "admin/quiz#update", as: :admin_update_quiz + + get "/admin/users", to: "admin/user#index", as: :admin_users + get "/admin/user/new", to: "admin/user#new", as: :admin_new_user + post "/admin/user/create", to: "admin/user#create", as: :admin_create_user + get "/admin/user/:user_id", to: "admin/user#view", as: :admin_user + get "/admin/user/:user_id/edit", to: "admin/user#edit", as: :admin_edit_user + post "/admin/user/:user_id/update", to: "admin/user#update", as: :admin_update_user + + get "/admin/questions", to: "admin/question#index", as: :admin_questions + get "/admin/question/new", to: "admin/question#new", as: :admin_new_question + post "/admin/question/create", to: "admin/question#create", as: :admin_create_question + get "/admin/question/:question_id", to: "admin/question#view", as: :admin_question + get "/admin/question/:question_id/edit", to: "admin/question#edit", as: :admin_edit_question + post "/admin/question/:question_id/update", to: "admin/question#update", as: :admin_update_question + + ######################################################################################### + post "/validate", to: "candidate#validate", as: :validate_candidate get "/login(/:test_id)", to: "candidate#login", as: :login get "/welcome", to: "candidate#welcome", as: :welcome diff --git a/test/controllers/admin/auth_controller_test.rb b/test/controllers/admin/auth_controller_test.rb new file mode 100644 index 0000000..af50302 --- /dev/null +++ b/test/controllers/admin/auth_controller_test.rb @@ -0,0 +1,21 @@ +require 'test_helper' + +module Admin + class AuthControllerTest < ActionDispatch::IntegrationTest + test "should get login" do + get admin_url + assert_response :success + assert_template 'admin/auth/login' + end + + test "should get auth" do + post admin_auth_url + assert_response :success + end + + test "should get logout" do + get admin_logout_url + assert_response :success + end + end +end diff --git a/test/controllers/admin/question_controller_test.rb b/test/controllers/admin/question_controller_test.rb new file mode 100644 index 0000000..00c2673 --- /dev/null +++ b/test/controllers/admin/question_controller_test.rb @@ -0,0 +1,35 @@ +require 'test_helper' + +module Admin + class QuestionControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get admin_questions_url + assert_response :success + end + + test "should get new" do + get admin_new_question_url + assert_response :success + end + + test "should post create" do + post admin_create_question_url + assert_response :success + end + + test "should get view" do + get admin_question_url questions(:fed5).to_i + assert_response :success + end + + test "should get edit" do + get admin_edit_question_url questions(:fed5).to_i + assert_response :success + end + + test "should post update question" do + post admin_update_question_url questions(:fed5).to_i + assert_response :success + end + end +end diff --git a/test/controllers/admin/quiz_controller_test.rb b/test/controllers/admin/quiz_controller_test.rb new file mode 100644 index 0000000..7fee204 --- /dev/null +++ b/test/controllers/admin/quiz_controller_test.rb @@ -0,0 +1,35 @@ +require 'test_helper' + +module Admin + class QuizControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get admin_quizzes_url + assert_response :success + end + + test "should get new" do + get admin_new_quiz_url + assert_response :success + end + + test "should post create" do + post admin_create_quiz_url + assert_response :success + end + + test "should get view" do + get admin_quiz_url quizzes(:fed).to_i + assert_response :success + end + + test "should get edit" do + get admin_edit_quiz_url quizzes(:fed).to_i + assert_response :success + end + + test "should post update quiz" do + post admin_update_quiz_url quizzes(:fed).to_i + assert_response :success + end + end +end diff --git a/test/controllers/admin/user_controller_test.rb b/test/controllers/admin/user_controller_test.rb new file mode 100644 index 0000000..c4773a5 --- /dev/null +++ b/test/controllers/admin/user_controller_test.rb @@ -0,0 +1,35 @@ +require 'test_helper' + +module Admin + class UserControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get admin_users_url + assert_response :success + end + + test "should get new" do + get admin_new_user_url + assert_response :success + end + + test "should post create" do + post admin_create_user_url + assert_response :success + end + + test "should get view" do + get admin_user_url users(:recruiter).to_i + assert_response :success + end + + test "should get edit" do + get admin_edit_user_url users(:recruiter).to_i + assert_response :success + end + + test "should post update user" do + post admin_update_user_url users(:recruiter).to_i + assert_response :success + end + end +end diff --git a/test/controllers/admin_controller_test.rb b/test/controllers/admin_controller_test.rb new file mode 100644 index 0000000..46d1e7b --- /dev/null +++ b/test/controllers/admin_controller_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class AdminControllerTest < ActionDispatch::IntegrationTest +end