From 2f355d504145dab07e190a6dd5bb37855f330486 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Fri, 31 Dec 2021 15:35:29 +0100 Subject: [PATCH] Add basic tests for followers & following in `UserController` --- spec/controllers/user_controller_spec.rb | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index 128d4e68..032c5062 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -21,6 +21,34 @@ describe UserController, type: :controller do end end + describe "#followers" do + subject { get :followers, params: { username: user.screen_name } } + + context "user signed in" do + before(:each) { sign_in user } + + it "renders the user/show_follow template" do + subject + expect(assigns(:user)).to eq(user) + expect(response).to render_template("user/show_follow") + end + end + end + + describe "#friends" do + subject { get :friends, params: { username: user.screen_name } } + + context "user signed in" do + before(:each) { sign_in user } + + it "renders the user/show_follow template" do + subject + expect(assigns(:user)).to eq(user) + expect(response).to render_template("user/show_follow") + end + end + end + describe "#edit" do subject { get :edit }