From 23fe0a2c6e9cbccfb064c6536c362d9ade5281eb Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Wed, 16 Nov 2022 22:33:30 +0100 Subject: [PATCH] Add tests for noindex setting --- spec/controllers/answer_controller_spec.rb | 16 ++++++++++++++++ spec/controllers/user_controller_spec.rb | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/spec/controllers/answer_controller_spec.rb b/spec/controllers/answer_controller_spec.rb index bca4b142..f58be191 100644 --- a/spec/controllers/answer_controller_spec.rb +++ b/spec/controllers/answer_controller_spec.rb @@ -18,5 +18,21 @@ describe AnswerController do expect(response).to render_template("answer/show") end end + + context "user opts out of search indexing" do + render_views + + before(:each) { + sign_in user + user.privacy_noindex = true + user.save + } + + it "renders the answer/show template" do + subject + expect(assigns(:answer)).to eq(answer) + expect(response.body).to include("") + end + end end end diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index 11599f0a..cccb727b 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -21,6 +21,22 @@ describe UserController, type: :controller do expect(response).to render_template("user/show") end end + + context "user opts out of search indexing" do + render_views + + before(:each) { + sign_in user + user.privacy_noindex = true + user.save + } + + it "renders the answer/show template" do + subject + expect(assigns(:user)).to eq(user) + expect(response.body).to include("") + end + end end describe "#followers" do