diff --git a/app/views/legislation/processes/_debate.html.erb b/app/views/legislation/processes/_debate.html.erb index 039ee1f6f..fe4c02cef 100644 --- a/app/views/legislation/processes/_debate.html.erb +++ b/app/views/legislation/processes/_debate.html.erb @@ -1,15 +1,17 @@
<% if process.questions.empty? %> -

<%= t('.empty_questions') %>

+

<%= t("legislation.processes.debate.empty_questions") %>

<% else %> <%= render process.questions %> <% end %>
-
-
-

<%= t('.participate') %>

+<% if process.questions.any? %> +
+
+

<%= t("legislation.processes.debate.participate") %>

+
-
+<% end %> \ No newline at end of file diff --git a/app/views/legislation/processes/debate.html.erb b/app/views/legislation/processes/debate.html.erb index a6042bd84..52969cef2 100644 --- a/app/views/legislation/processes/debate.html.erb +++ b/app/views/legislation/processes/debate.html.erb @@ -13,7 +13,7 @@
<% if @process.questions.empty? %>
-

<%= t('.empty_questions') %>

+

<%= t("legislation.processes.debate.empty_questions") %>

<% else %> <%= render @process.questions %> @@ -21,11 +21,13 @@
-
-
-

<%= t('.participate') %>

+ <% if @process.questions.any? %> +
+
+

<%= t("legislation.processes.debate.participate") %>

+
-
+ <% end %>
diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 73d1f46d9..0f233a577 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -149,15 +149,30 @@ feature 'Legislation' do visit legislation_process_path(process) - expect(page).to have_content("This phase is not open yet") + expect(page).to have_content("This phase is not open yet") + expect(page).to_not have_content("Participate in the debate") end - scenario 'open' do + scenario 'open without questions' do process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days) visit legislation_process_path(process) - expect(page).to have_content("Participate in the debate") + expect(page).to_not have_content("Participate in the debate") + expect(page).to_not have_content("This phase is not open yet") + end + + scenario 'open with questions' do + process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days) + create(:legislation_question, process: process, title: "Question 1") + create(:legislation_question, process: process, title: "Question 2") + + visit legislation_process_path(process) + + expect(page).to have_content("Question 1") + expect(page).to have_content("Question 2") + expect(page).to have_content("Participate in the debate") + expect(page).to_not have_content("This phase is not open yet") end include_examples "not published permissions", :debate_legislation_process_path