diff --git a/app/views/case_contacts/case_contacts_new_design/index.html.erb b/app/views/case_contacts/case_contacts_new_design/index.html.erb index 82509394fc..e2873841ac 100644 --- a/app/views/case_contacts/case_contacts_new_design/index.html.erb +++ b/app/views/case_contacts/case_contacts_new_design/index.html.erb @@ -1,8 +1,10 @@
-
-
-

Case Contacts

-
+
+

Case Contacts

+ <%= link_to new_case_contact_path, class: "main-btn primary-btn btn-sm btn-hover" do %> + + New Case Contact + <% end %>
diff --git a/spec/system/case_contacts/case_contacts_new_design_spec.rb b/spec/system/case_contacts/case_contacts_new_design_spec.rb index af2364a531..afbae54c5a 100644 --- a/spec/system/case_contacts/case_contacts_new_design_spec.rb +++ b/spec/system/case_contacts/case_contacts_new_design_spec.rb @@ -25,6 +25,37 @@ end end + describe "New Case Contact button" do + include_context "signed in as admin" + + it "is visible to an admin" do + expect(page).to have_link("New Case Contact", href: new_case_contact_path) + end + + it "navigates to the new case contact form when clicked as an admin" do + click_link "New Case Contact" + expect(page).to have_current_path(%r{/case_contacts/\d+/form/details}) + end + + context "when signed in as a volunteer" do + let(:volunteer) { create(:volunteer, casa_org: organization) } + + before do + sign_in volunteer + visit case_contacts_new_design_path + end + + it "is visible to a volunteer" do + expect(page).to have_link("New Case Contact", href: new_case_contact_path) + end + + it "navigates to the new case contact form when clicked as a volunteer" do + click_link "New Case Contact" + expect(page).to have_current_path(%r{/case_contacts/\d+/form/details}) + end + end + end + describe "row expansion" do include_context "signed in as admin" it "shows the expanded content after clicking the chevron" do