diff --git a/app/controllers/msip/homonimos_controller.rb b/app/controllers/msip/homonimos_controller.rb index a97e9de..86aad7c 100644 --- a/app/controllers/msip/homonimos_controller.rb +++ b/app/controllers/msip/homonimos_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Msip - class HomonimosController < Msip::ModelosController + class HomonimosController < Heb412Gen::ModelosController before_action :set_homonimo, only: [:show, :edit, :update, :destroy] load_and_authorize_resource class: Msip::Homonimo @@ -35,6 +35,14 @@ def atributos_form a end + def vistas_manejadas + ["Homonimo"] + end + + def index + super() + end + def set_homonimo @homonimo = Msip::Homonimo.find(params[:id]) @registro = @homonimo diff --git a/test/controllers/msip/homonimos_controller_test.rb b/test/controllers/msip/homonimos_controller_test.rb index 2b84b35..462498f 100644 --- a/test/controllers/msip/homonimos_controller_test.rb +++ b/test/controllers/msip/homonimos_controller_test.rb @@ -204,19 +204,25 @@ def dedup_ruta(ruta) id: nil }}) end - debugger assert_redirected_to dedup_ruta(homonimo_path( assigns(:homonimo) )) - debugger - idr = response.body.gsub(%r{.*homonimos/}, "").gsub(/">.*/, "").to_i - homonimo = Msip::Homonimo.all.take sign_in @current_usuario # Si no se hace nuevamente sign_in produce error: - # CanCan::AccessDenied: No está autorizado para show Homonimo. + # CanCan::AccessDenied: No está autorizado para index Homonimo. + + get homonimos_path + idr = response.body.match(/numregistros">[0-9]*/)[0][14..-1].to_i + assert_equal 1, idr + + homonimo = Msip::Homonimo.all.take r = dedup_ruta(homonimo_url(homonimo)) + sign_in @current_usuario + # Si no se hace nuevamente sign_in produce error: + # CanCan::AccessDenied: No está autorizado para index Homonimo. + get r assert_response :success @@ -229,9 +235,8 @@ def dedup_ruta(ruta) assert_template :edit sign_in @current_usuario - debugger assert_difference("Homonimo.count", -1) do - delete dedup_ruta(homonimo_path(Homonimo.find(idr))) + delete dedup_ruta(homonimo_path(Homonimo.find(homonimo.id))) end assert_redirected_to dedup_ruta(homonimos_path)