Skip to content

Commit afd7886

Browse files
committed
feat(procedure): apply noindex directive on non indexable procedure
1 parent 896f3e6 commit afd7886

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

app/views/commencer/show.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- content_for(:title, @procedure.libelle)
2-
- content_for(:meta_robots, @procedure.publiee? ? "index,follow" : "noindex,nofollow")
2+
- content_for(:meta_robots, @procedure.publiee? && @procedure.robots_indexable? ? "index,follow" : "noindex,nofollow")
33

44
.commencer.form
55
- if !user_signed_in?

spec/controllers/users/commencer_controller_spec.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
describe Users::CommencerController, type: :controller do
44
let(:user) { create(:user) }
5-
let(:published_procedure) { create(:procedure, :for_individual, :published, types_de_champ_public:) }
5+
let(:published_procedure) { create(:procedure, :for_individual, :published, types_de_champ_public:, robots_indexable:) }
66
let(:types_de_champ_public) { [] }
77
let(:draft_procedure) { create(:procedure, :with_path) }
8+
let(:robots_indexable) { true }
89

910
describe '#commencer' do
1011
subject { get :commencer, params: { path: path } }
@@ -22,6 +23,17 @@
2223
end
2324
end
2425

26+
context "when procedure is not indexable" do
27+
render_views
28+
let(:robots_indexable) { false }
29+
let(:path) { published_procedure.path }
30+
31+
it "apply robots directives" do
32+
subject
33+
expect(response.body).to include("noindex,nofollow")
34+
end
35+
end
36+
2537
context 'when there is an old path' do
2638
let!(:old_path) do
2739
travel_to(1.day.ago) do

0 commit comments

Comments
 (0)