Add tests for noindex setting

This commit is contained in:
Andreas Nedbal 2022-11-16 22:33:30 +01:00
parent 4c820b472e
commit 23fe0a2c6e
2 changed files with 32 additions and 0 deletions

View File

@ -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("<meta content='noindex' name='robots'>")
end
end
end
end

View File

@ -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("<meta content='noindex' name='robots'>")
end
end
end
describe "#followers" do