diff --git a/app/views/casa_cases/_form.html.erb b/app/views/casa_cases/_form.html.erb
index f545567e2d..b0d3e440d1 100644
--- a/app/views/casa_cases/_form.html.erb
+++ b/app/views/casa_cases/_form.html.erb
@@ -25,17 +25,19 @@
<% end %>
- <% if policy(casa_case).update_judge? %>
-
- <%= form.label :judge_id %>
- <%= form.collection_select(
- :judge_id,
- Judge.for_organization(current_organization),
- :id, :name,
- { include_hidden: false, prompt: "-Select Judge-" },
- { class: "form-control" }
- ) %>
-
+ <% if Judge.for_organization(current_organization).any? %>
+ <% if policy(casa_case).update_judge? %>
+
+ <%= form.label :judge_id %>
+ <%= form.collection_select(
+ :judge_id,
+ Judge.for_organization(current_organization),
+ :id, :name,
+ { include_hidden: false, prompt: "-Select Judge-" },
+ { class: "form-control" }
+ ) %>
+
+ <% end %>
<% end %>
diff --git a/spec/system/supervisor_edits_case_spec.rb b/spec/system/supervisor_edits_case_spec.rb
index 12f82d5fd2..54c13cc605 100644
--- a/spec/system/supervisor_edits_case_spec.rb
+++ b/spec/system/supervisor_edits_case_spec.rb
@@ -96,4 +96,24 @@
expect(page).not_to have_text("Reactivate Case")
expect(page).not_to have_text("Update Casa Case")
end
+
+ context "When a Casa instance has no judge names added" do
+ it "does not display judge names details" do
+ casa_case = create(:casa_case, casa_org: casa_org, judge: nil)
+
+ visit edit_casa_case_path(casa_case)
+
+ expect(page).not_to have_select("Judge")
+ end
+ end
+
+ context "When an admin has added judge names to a Casa instance" do
+ it "displays judge details as select option" do
+ judge = create :judge, casa_org: casa_org
+
+ visit edit_casa_case_path(casa_case)
+
+ expect(page).to have_select("Judge")
+ end
+ end
end