From e417d755a4b1c5cee912d7afb57edcbe1f4a0c2d Mon Sep 17 00:00:00 2001 From: Yalaeddin Date: Tue, 16 Apr 2024 11:03:43 +0200 Subject: [PATCH] =?UTF-8?q?Ne=20pas=20appliquer=20le=20filtre=20par=20trac?= =?UTF-8?q?ker=20dans=20la=20page=20template/index=20s'ils=20sont=20tous?= =?UTF-8?q?=20s=C3=A9lectionn=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issue_templates/_filters.html.erb | 1 + .../issue_templates/_list_template.html.erb | 2 +- .../system/issue_templates_controller_spec.rb | 23 ++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/views/issue_templates/_filters.html.erb b/app/views/issue_templates/_filters.html.erb index 6bbb367..e796889 100644 --- a/app/views/issue_templates/_filters.html.erb +++ b/app/views/issue_templates/_filters.html.erb @@ -11,6 +11,7 @@ <% end %> + <%= check_box_tag 'tracker_ids[]', 0, 1, :id => nil, :style => 'display:none;' %> <% end %> diff --git a/app/views/issue_templates/_list_template.html.erb b/app/views/issue_templates/_list_template.html.erb index 2dc3360..8dcbb65 100644 --- a/app/views/issue_templates/_list_template.html.erb +++ b/app/views/issue_templates/_list_template.html.erb @@ -10,7 +10,7 @@ %> <% link_to_edition = Proc.new do |label, title| diff --git a/spec/system/issue_templates_controller_spec.rb b/spec/system/issue_templates_controller_spec.rb index 826c84a..68d6e88 100644 --- a/spec/system/issue_templates_controller_spec.rb +++ b/spec/system/issue_templates_controller_spec.rb @@ -146,5 +146,26 @@ def find_closest_label(labels ,target_element) end end end - + + describe "Template index" do + + before do + log_user('admin', 'admin') + end + + it "Should not apply the filter by tracker if all trackers are selected" do + # Removing a tracker to simulate the absence of a tracker + tracker_to_remove = Tracker.find(3) + tracker_to_remove.destroy + + # Retrieving the issue template without a tracker + template_without_tracker = IssueTemplate.last + + # Verifying that the issue template has a tracker_id equal to 0 + expect(template_without_tracker.tracker_id).to eq(0) + + visit "/issue_templates" + expect(page.body).to have_selector("a", text: "#{template_without_tracker.template_title}") + end + end end