From b46fae5ebd88501af3d8d5e12d1331356a2e41c0 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 21 Aug 2022 12:58:58 +0200 Subject: [PATCH] Rename index action to show action --- app/controllers/moderation/questions_controller.rb | 2 +- app/views/moderation/questions/{index.haml => show.haml} | 0 config/routes.rb | 2 +- spec/controllers/moderation/questions_controller_spec.rb | 8 ++++---- 4 files changed, 6 insertions(+), 6 deletions(-) rename app/views/moderation/questions/{index.haml => show.haml} (100%) diff --git a/app/controllers/moderation/questions_controller.rb b/app/controllers/moderation/questions_controller.rb index 7b9aa219..75e2832c 100644 --- a/app/controllers/moderation/questions_controller.rb +++ b/app/controllers/moderation/questions_controller.rb @@ -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 diff --git a/app/views/moderation/questions/index.haml b/app/views/moderation/questions/show.haml similarity index 100% rename from app/views/moderation/questions/index.haml rename to app/views/moderation/questions/show.haml diff --git a/config/routes.rb b/config/routes.rb index 49ac0b66..a1ab0fea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/spec/controllers/moderation/questions_controller_spec.rb b/spec/controllers/moderation/questions_controller_spec.rb index 07c81676..48cc9261 100644 --- a/spec/controllers/moderation/questions_controller_spec.rb +++ b/spec/controllers/moderation/questions_controller_spec.rb @@ -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