From ca043d56ef95beffa2c8dfaee14e407458938062 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 29 Oct 2023 21:14:26 +0100 Subject: [PATCH 1/2] Rename `ReactionController` to `ReactionsController` --- .../{reaction_controller.rb => reactions_controller.rb} | 2 +- app/views/{reaction => reactions}/index.html.haml | 0 config/routes.rb | 2 +- ...reaction_controller_spec.rb => reactions_controller_spec.rb} | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename app/controllers/{reaction_controller.rb => reactions_controller.rb} (77%) rename app/views/{reaction => reactions}/index.html.haml (100%) rename spec/controllers/{reaction_controller_spec.rb => reactions_controller_spec.rb} (94%) diff --git a/app/controllers/reaction_controller.rb b/app/controllers/reactions_controller.rb similarity index 77% rename from app/controllers/reaction_controller.rb rename to app/controllers/reactions_controller.rb index c6df6000..fbf01fce 100644 --- a/app/controllers/reaction_controller.rb +++ b/app/controllers/reactions_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ReactionController < ApplicationController +class ReactionsController < ApplicationController def index answer = Answer.includes([smiles: { user: :profile }]).find(params[:id]) diff --git a/app/views/reaction/index.html.haml b/app/views/reactions/index.html.haml similarity index 100% rename from app/views/reaction/index.html.haml rename to app/views/reactions/index.html.haml diff --git a/config/routes.rb b/config/routes.rb index 7e5e259c..3161f9f8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -155,7 +155,7 @@ Rails.application.routes.draw do post "/@:username/a/:id/pin", to: "answer#pin", as: :pin_answer delete "/@:username/a/:id/pin", to: "answer#unpin", as: :unpin_answer get "/@:username/a/:id/comments", to: "comment#index", as: :comments - get "/@:username/a/:id/reactions", to: "reaction#index", as: :reactions + get "/@:username/a/:id/reactions", to: "reactions#index", as: :reactions get "/@:username/q/:id", to: "question#show", as: :question get "/@:username/c/:id/reactions", to: "comment#show_reactions", as: :comment_reactions get "/@:username/followers", to: "user#followers", as: :show_user_followers diff --git a/spec/controllers/reaction_controller_spec.rb b/spec/controllers/reactions_controller_spec.rb similarity index 94% rename from spec/controllers/reaction_controller_spec.rb rename to spec/controllers/reactions_controller_spec.rb index 1b76617f..605a515c 100644 --- a/spec/controllers/reaction_controller_spec.rb +++ b/spec/controllers/reactions_controller_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -describe ReactionController, type: :controller do +describe ReactionsController, type: :controller do describe "#index" do shared_examples_for "succeeds" do it "returns the correct response" do From b7808e85c616463bcf3bfa198d60069215a984cd Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 29 Oct 2023 21:38:50 +0100 Subject: [PATCH 2/2] Check proper render result in spec --- spec/controllers/reactions_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/reactions_controller_spec.rb b/spec/controllers/reactions_controller_spec.rb index 605a515c..e5e7ede5 100644 --- a/spec/controllers/reactions_controller_spec.rb +++ b/spec/controllers/reactions_controller_spec.rb @@ -7,7 +7,7 @@ describe ReactionsController, type: :controller do shared_examples_for "succeeds" do it "returns the correct response" do subject - expect(response).to have_rendered("reaction/index") + expect(response).to have_rendered :index expect(response).to have_http_status(200) end end