Skip to content

Commit

Permalink
feat: add some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticspoon committed Sep 8, 2024
1 parent 4c2fa9f commit ce5e3e0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion spec/controllers/concerns/accessible_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,38 @@ def no_session_action
let(:volunteer) { create(:volunteer) }

context "Authenticated user" do
before :each do
before do
Rails.application.reload_routes!
Rails.application.routes.disable_clear_and_finalize = true
Rails.application.routes.draw do
get :action, to: "mock#action"
get :no_session_action, to: "mock#no_session_action"
end
end
after { Rails.application.routes_reloader.reload! }

it "should redirect to authenticated casa admin root path" do
debug
allow(controller).to receive(:authenticate_user!).and_return(true)
allow(controller).to receive(:current_all_casa_admin).and_return(admin)
get :action
expect(response).to redirect_to authenticated_all_casa_admin_root_path
end

it "should redirect to authenticated user root path" do
debug
allow(controller).to receive(:authenticate_user!).and_return(true)
allow(controller).to receive(:current_user).and_return(volunteer)
get :no_session_action
expect(response).to redirect_to authenticated_user_root_path
end
end

def debug
return unless ENV["CI"]

Rails.application.routes.routes.each do |route|
puts route.path.spec.to_s
end
end
end

0 comments on commit ce5e3e0

Please sign in to comment.