Skip to content

Commit 52baa44

Browse files
Build factories instead of create as much as possible to decrease test setup
1 parent 8ba192f commit 52baa44

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

spec/system/volunteers/edit_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
it "shows the admin the option to assign an unassigned volunteer to a different active supervisor" do
234234
organization = create(:casa_org)
235235
volunteer = create(:volunteer, casa_org: organization)
236-
deactivated_supervisor = create(:supervisor, active: false, casa_org: organization, display_name: "Inactive Supervisor")
236+
deactivated_supervisor = build(:supervisor, active: false, casa_org: organization, display_name: "Inactive Supervisor")
237237
active_supervisor = create(:supervisor, active: true, casa_org: organization, display_name: "Active Supervisor")
238238
admin = create(:casa_admin, casa_org: organization)
239239

@@ -295,8 +295,8 @@
295295
volunteer = create(:volunteer, :with_assigned_supervisor, casa_org_id: organization.id)
296296
casa_case_1 = create(:casa_case, casa_org: organization, case_number: "CINA1")
297297
casa_case_2 = create(:casa_case, casa_org: organization, case_number: "CINA2")
298-
case_assignment_1 = create(:case_assignment, volunteer: volunteer, casa_case: casa_case_1)
299-
case_assignment_2 = create(:case_assignment, volunteer: volunteer, casa_case: casa_case_2)
298+
case_assignment_1 = build(:case_assignment, volunteer: volunteer, casa_case: casa_case_1)
299+
case_assignment_2 = build(:case_assignment, volunteer: volunteer, casa_case: casa_case_2)
300300

301301
case_assignment_1.active = false
302302
case_assignment_2.active = false

spec/system/volunteers/notes/edit_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
RSpec.describe "volunteers/notes/edit", type: :system do
44
let(:organization) { create(:casa_org) }
5-
let(:admin) { create(:casa_admin, casa_org_id: organization.id) }
5+
let(:admin) { build(:casa_admin, casa_org_id: organization.id) }
66
let(:volunteer) { create(:volunteer, :with_assigned_supervisor, casa_org_id: organization.id) }
77
let(:note) { volunteer.notes.create(creator: admin, content: "Good job.") }
88

0 commit comments

Comments
 (0)