Rename index action to show action

This commit is contained in:
Andreas Nedbal 2022-08-21 12:58:58 +02:00 committed by Andreas Nedbal
parent 9c159bd5cc
commit b46fae5ebd
4 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@
class Moderation::QuestionsController < ApplicationController
before_action :authenticate_user!
def index
def show
@questions = Question.where(author_identifier: params[:author_identifier])
end
end

View File

@ -26,7 +26,7 @@ Rails.application.routes.draw do
get "/moderation/blocks", to: "moderation/anonymous_block#index", as: :mod_anon_block_index
get "/moderation/reports(/:type)", to: "moderation/reports#index", as: :moderation_reports, defaults: { type: "all" }
get "/moderation/inbox/:user", to: "moderation/inbox#index", as: :mod_inbox_index
get "/moderation/questions/:author_identifier", to: "moderation/questions#index", as: :moderation_questions
get "/moderation/questions/:author_identifier", to: "moderation/questions#show", as: :moderation_questions
namespace :ajax do
post "/mod/destroy_report", to: "moderation#destroy_report", as: :mod_destroy_report
post "/mod/privilege", to: "moderation#privilege", as: :mod_privilege

View File

@ -5,8 +5,8 @@ require "rails_helper"
describe Moderation::QuestionsController, type: :controller do
let(:user) { FactoryBot.create :user, roles: ["moderator"] }
describe "#index" do
subject { get :index, params: }
describe "#show" do
subject { get :show, params: }
let(:params) { { author_identifier: "test" } }
@ -14,9 +14,9 @@ describe Moderation::QuestionsController, type: :controller do
sign_in user
end
it "renders the moderation/questions/index template" do
it "renders the moderation/questions/show template" do
subject
expect(response).to render_template("moderation/questions/index")
expect(response).to render_template("moderation/questions/show")
end
end
end