Skip to content

Commit

Permalink
Arregla prueba de regresion. Closes #301
Browse files Browse the repository at this point in the history
  • Loading branch information
vtamara committed Nov 28, 2024
1 parent 9e63199 commit aceba1a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
10 changes: 9 additions & 1 deletion app/controllers/msip/homonimos_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions test/controllers/msip/homonimos_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit aceba1a

Please sign in to comment.