diff --git a/test/functional/guidance_groups_controller_test.rb b/test/functional/guidance_groups_controller_test.rb new file mode 100644 index 0000000..b708c93 --- /dev/null +++ b/test/functional/guidance_groups_controller_test.rb @@ -0,0 +1,96 @@ +class GuidanceGroupsControllerTest < ActionDispatch::IntegrationTest + + include Devise::Test::IntegrationHelpers + + # TODO: The following methods SHOULD replace the old 'admin_' prefixed methods. The routes file already has + # these defined. They are defined multiple times though and we need to clean this up! In particular + # look at the unnamed routes after 'new_plan_phase' below. They are not named because they are duplicates. + # We should just have: + # + # SHOULD BE: + # -------------------------------------------------- + # guidance_groups GET /guidance_groups guidance_groups#index + # POST /guidance_groups guidance_groups#create + # guidance_group GET /guidance_group/:id guidance_groups#show + # PATCH /guidance_groups/:id guidance_groups#update + # PUT /guidance_groups/:id guidance_groups#update + # DELETE /guidance_groups/:id guidance_groups#destroy + # + # CURRENT RESULTS OF `rake routes` + # -------------------------------------------------- + # admin_show_guidance_group GET /org/admin/guidancegroup/:id/admin_show guidance_groups#admin_show + # admin_new_guidance_group GET /org/admin/guidancegroup/:id/admin_new guidance_groups#admin_new + # admin_edit_guidance_group GET /org/admin/guidancegroup/:id/admin_edit guidance_groups#admin_edit + # admin_destroy_guidance_group DELETE /org/admin/guidancegroup/:id/admin_destroy guidance_groups#admin_destroy + # admin_create_guidance_group POST /org/admin/guidancegroup/:id/admin_create guidance_groups#admin_create + # admin_update_guidance_group PUT /org/admin/guidancegroup/:id/admin_update guidance_groups#admin_update + + setup do + @user = User.where(org: GuidanceGroup.first.org).select{|u| u.can_org_admin?}.first + end + + # GET /org/admin/guidancegroup/:id/admin_show (admin_show_guidance_group_path) + # ---------------------------------------------------------- + test 'show the guidance_group' do + # Should redirect user to the root path if they are not logged in! + get admin_show_guidance_group_path(GuidanceGroup.find_by(org: @user.org)) + assert_unauthorized_redirect_to_root_path + + sign_in @user + + get admin_show_guidance_group_path(GuidanceGroup.find_by(org: @user.org)) + assert_response :success + end + + # GET /org/admin/guidancegroup/:id/admin_new (admin_new_guidance_group_path) + # ---------------------------------------------------------- + test 'load the new guidance_group page' do + # Should redirect user to the root path if they are not logged in! + # TODO: Why is there an id here!? its a new guidance_group! + get admin_new_guidance_group_path(@user.org) + assert_unauthorized_redirect_to_root_path + + sign_in @user + + get admin_new_guidance_group_path(@user.org) + assert_response :success + end + + # POST /org/admin/guidancegroup/:id/admin_create (admin_create_guidance_group_path) + # ---------------------------------------------------------- + test 'create a new guidance_group' do + + end + + # GET /org/admin/guidancegroup/:id/admin_edit (admin_edit_guidance_group_path) + # ---------------------------------------------------------- + test 'load the edit guidance_group page' do + # Should redirect user to the root path if they are not logged in! + get admin_edit_guidance_group_path(GuidanceGroup.find_by(org: @user.org)) + assert_unauthorized_redirect_to_root_path + + sign_in @user + + get admin_edit_guidance_group_path(GuidanceGroup.find_by(org: @user.org)) + assert_response :success + end + + # PUT /org/admin/templates/:id/admin_template (admin_update_guidance_group_path) + # ---------------------------------------------------------- + test 'update the guidance_group' do + + end + + # PUT /org/admin/guidancegroup/:id/admin_update (admin_update_guidance_group_path) + # ---------------------------------------------------------- + test 'publish the guidance_group' do + + end + + # DELETE /org/admin/guidancegroup/:id/admin_destroy (admin_destroy_guidance_group_path) + # ---------------------------------------------------------- + test 'delete the guidance_group' do + + end + +end \ No newline at end of file diff --git a/test/functional/questions_controller_test.rb b/test/functional/questions_controller_test.rb index fbcf4b1..6df2125 100644 --- a/test/functional/questions_controller_test.rb +++ b/test/functional/questions_controller_test.rb @@ -31,16 +31,6 @@ # admin_create_question POST /org/admin/templates/questions/:id/admin_create questions#admin_create # admin_update_question PUT /org/admin/templates/questions/:id/admin_update questions#admin_update # admin_destroy_question DELETE /org/admin/templates/questions/:id/admin_destroy questions#admin_destroy -# -# admin_questions GET /admin/questions admin/questions#index -# POST /admin/questions admin/questions#create -# new_admin_question GET /admin/questions/new admin/questions#new -# edit_admin_question GET /admin/questions/:id/edit admin/questions#edit -# admin_question GET /admin/questions/:id admin/questions#show -# PATCH /admin/questions/:id admin/questions#update -# PUT /admin/questions/:id admin/questions#update -# DELETE /admin/questions/:id admin/questions#destroy - # POST /org/admin/templates/questions/:id/admin_create (admin_create_question_path) diff --git a/test/functional/sections_controller_test.rb b/test/functional/sections_controller_test.rb index cb0dc88..c559d87 100644 --- a/test/functional/sections_controller_test.rb +++ b/test/functional/sections_controller_test.rb @@ -29,15 +29,6 @@ # admin_create_section POST /org/admin/templates/sections/:id/admin_create sections#admin_create # admin_update_section PUT /org/admin/templates/sections/:id/admin_update sections#admin_update # admin_destroy_section DELETE /org/admin/templates/sections/:id/admin_destroy sections#admin_destroy -# -# admin_sections GET /admin/sections(.:format) admin/sections#index -# POST /admin/sections(.:format) admin/sections#create -# new_admin_section GET /admin/sections/new(.:format) admin/sections#new -# edit_admin_section GET /admin/sections/:id/edit(.:format) admin/sections#edit -# admin_section GET /admin/sections/:id(.:format) admin/sections#show -# PATCH /admin/sections/:id(.:format) admin/sections#update -# PUT /admin/sections/:id(.:format) admin/sections#update -# DELETE /admin/sections/:id(.:format) admin/sections#destroy diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index 6884d85..468fd0e 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -34,15 +34,6 @@ # admin_destroy_template DELETE /org/admin/templates/:id/admin_destroy(.:format) templates#admin_destroy # admin_create_template POST /org/admin/templates/:id/admin_create(.:format) templates#admin_create # admin_update_template PUT /org/admin/templates/:id/admin_update(.:format) templates#admin_update -# -# admin_templates GET /admin/templates(.:format) admin/templates#index -# POST /admin/templates(.:format) admin/templates#create -# new_admin_template GET /admin/templates/new(.:format) admin/templates#new -# edit_admin_template GET /admin/templates/:id/edit(.:format) admin/templates#edit -# admin_template GET /admin/templates/:id(.:format) admin/templates#show -# PATCH /admin/templates/:id(.:format) admin/templates#update -# PUT /admin/templates/:id(.:format) admin/templates#update -# DELETE /admin/templates/:id(.:format) admin/templates#destroy # GET /org/admin/templates/:id/admin_index (admin_index_template_path) the :id here makes no sense!