-
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add system spec for new bulk court dates
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryBot.define do | ||
factory :case_group do | ||
name { "A family" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "bulk_court_dates/new", type: :system do | ||
let(:now) { Date.new(2021, 1, 1) } | ||
let(:casa_org) { create(:casa_org) } | ||
let(:admin) { create(:casa_admin, casa_org: casa_org) } | ||
let!(:casa_case) { create(:casa_case, casa_org: casa_org) } | ||
let!(:court_date) { create(:court_date, :with_court_details, casa_case: casa_case, date: now - 1.week) } | ||
let!(:judge) { create(:judge) } | ||
let!(:hearing_type) { create(:hearing_type) } | ||
let(:court_order_text) { Faker::Lorem.paragraph(sentence_count: 2) } | ||
|
||
it "is successful", js: true do | ||
case_group = build(:case_group, casa_org: casa_org) | ||
case_group.case_group_memberships.build(casa_case: casa_case) | ||
case_group.save! | ||
|
||
travel_to now | ||
sign_in admin | ||
visit casa_cases_path | ||
click_on "New Bulk Court Date" | ||
|
||
select case_group.name, from: "Case Group" | ||
fill_in "court_date_date", with: :now | ||
fill_in "court_date_court_report_due_date", with: :now | ||
select judge.name, from: "Judge" | ||
select hearing_type.name, from: "Hearing type" | ||
|
||
click_on "Add a court order" | ||
text_area = first(:css, "textarea").native | ||
text_area.send_keys(court_order_text) | ||
page.find("select.implementation-status").find(:option, text: "Partially implemented").select_option | ||
|
||
within ".top-page-actions" do | ||
click_on "Create" | ||
end | ||
|
||
visit casa_case_path(casa_case) | ||
expect(page).to have_content(hearing_type.name) | ||
expect(page).to have_content(court_order_text) | ||
end | ||
end |