Skip to content

Commit

Permalink
Fixed some formatting with for respec
Browse files Browse the repository at this point in the history
  • Loading branch information
grantmca committed May 27, 2023
1 parent 3f42ae2 commit 1aa1f0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/partners/families_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def index
current_partner.families
.order(sort_order),
params[:filterrific],
default_filter_params: {"include_archived"=>0},
default_filter_params: {"include_archived" => 0}
) || return

@families = @filterrific.find
Expand Down
5 changes: 2 additions & 3 deletions app/models/partners/family.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Family < Base
scope :search_agency_guardians, ->(query) { where('case_manager ilike ?', "%#{query}%") }
scope :include_archived, ->(query) { query.zero? ? where(archived: false) : all }


INCOME_TYPES = ['SSI', 'SNAP/FOOD Stamps', 'TANF', 'WIC', 'Housing/subsidized', 'Housing/unsubsidized', 'N/A'].freeze
INSURANCE_TYPES = ['Private insurance', 'Medicaid', 'Uninsured'].freeze
EMPLOYMENT_TYPES = %w[Full-time Part-time N/A].freeze
Expand All @@ -64,7 +63,7 @@ def create_authorized
end

def archive_children
children.update_all(archived: true)
children.each { |c| c.update(archived: true) }
end

def guardian_display_name
Expand Down Expand Up @@ -106,7 +105,7 @@ def csv_export_attributes
updated_at,
partner_id,
military,
archived,
archived
]
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/requests/partners/family_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
comments: "Some comment 2",
military: true,
partner: partner,
archived: true,)
archived: true)
end

describe "GET #index" do
Expand All @@ -59,14 +59,14 @@
end

it "should render without any issues and present all families" do
get partners_families_path, params: {"filterrific"=>{"include_archived"=>"1"}}
get partners_families_path, params: {"filterrific" => {"include_archived" => "1"}}
expect(response).to render_template(:index)
expect(assigns[:families].count).to eq(2)
end

it "should export CSV" do
headers = {"Accept" => "text/csv", "Content-Type" => "text/csv"}
params = {"filterrific"=>{"search_guardian_names"=>"", "search_agency_guardians"=>"", "include_archived"=>"1"}}
params = {"filterrific" => {"search_guardian_names" => "", "search_agency_guardians" => "", "include_archived" => "1"}}
get partners_families_path, headers: headers, params: params
csv = <<~CSV
id,guardian_first_name,guardian_last_name,guardian_zip_code,guardian_county,guardian_phone,case_manager,home_adult_count,home_child_count,home_young_child_count,sources_of_income,guardian_employed,guardian_employment_type,guardian_monthly_pay,guardian_health_insurance,comments,created_at,updated_at,partner_id,military,archived
Expand Down

0 comments on commit 1aa1f0b

Please sign in to comment.