|
57 | 57 | let(:name) { "Leslie Sue" } |
58 | 58 | let(:email) { "leslie@sue.com" } |
59 | 59 | let(:notes) { "Some notes" } |
60 | | - let(:providing_diapers) { {value: "N", index: 22} } |
61 | | - let(:providing_period_supplies) { {value: "N", index: 23} } |
62 | | - |
63 | 60 | let(:agency_type) { :other } # Columns from the agency_information partial |
64 | 61 | let(:other_agency_type) { "Another Agency Name" } |
65 | 62 | let(:agency_mission) { "agency_mission" } |
|
81 | 78 | let(:enable_quantity_based_requests) { true } # Columns from the partner_settings partial |
82 | 79 | let(:enable_child_based_requests) { true } |
83 | 80 | let(:enable_individual_requests) { true } |
| 81 | + let(:providing_diapers) { {value: "N", index: -2} } |
| 82 | + let(:providing_period_supplies) { {value: "N", index: -1} } |
84 | 83 |
|
85 | 84 | let(:expected_headers) { |
86 | 85 | [ |
87 | | - "Agency Name", |
| 86 | + "Agency Name", # Technically not part of the agency_information partial, but comes at the start of the export |
88 | 87 | "Agency Email", |
| 88 | + "Notes", |
89 | 89 | "Agency Type", # Columns from the agency_information partial |
| 90 | + "Other Agency Type", |
90 | 91 | "Agency Mission", |
91 | 92 | "Agency Address", |
92 | 93 | "Agency City", |
|
96 | 97 | "Program City", |
97 | 98 | "Program State", |
98 | 99 | "Program Zip Code", |
99 | | - "Notes", |
100 | | - "Counties Served", |
101 | | - "Providing Diapers", |
102 | | - "Providing Period Supplies", |
103 | 100 | "Agency Website", # Columns from the media_information partial |
104 | 101 | "Facebook", |
105 | 102 | "Twitter", |
106 | 103 | "Instagram", |
107 | 104 | "No Social Media Presence", |
108 | | - "Quantity-based Requests", # Columns from the partner_settings partial |
| 105 | + "Quantity-based Requests", # Columns from the agency_information partial |
109 | 106 | "Child-based Requests", |
110 | | - "Individual Requests" |
| 107 | + "Individual Requests", |
| 108 | + "Providing Diapers", # Technically not part of the partner_settings partial, but comes at the end of the export |
| 109 | + "Providing Period Supplies" |
111 | 110 | ] |
112 | 111 | } |
113 | 112 |
|
114 | 113 | let(:expected_values) { |
115 | 114 | [ |
116 | | - partner.name, |
| 115 | + partner.name, # Technically not part of the agency_information partial, but comes at the start of the export |
117 | 116 | partner.email, |
118 | | - "#{I18n.t "partners_profile.other"}: #{other_agency_type}", # Columns from the agency_information partial |
| 117 | + notes, |
| 118 | + I18n.t("partners_profile.other").to_s, # Columns from the agency_information partial |
| 119 | + other_agency_type.to_s, |
119 | 120 | agency_mission, |
120 | 121 | "#{agency_address1}, #{agency_address2}", |
121 | 122 | agency_city, |
|
125 | 126 | program_city, |
126 | 127 | program_state, |
127 | 128 | program_zip_code.to_s, |
128 | | - notes, |
129 | | - "", |
130 | | - providing_diapers[:value], |
131 | | - providing_period_supplies[:value], |
132 | 129 | agency_website, # Columns from the media_information partial |
133 | 130 | facebook, |
134 | 131 | twitter, |
135 | 132 | instagram, |
136 | 133 | no_social_media_presence.to_s, |
137 | 134 | enable_quantity_based_requests.to_s, # Columns from the partner_settings partial |
138 | 135 | enable_child_based_requests.to_s, |
139 | | - enable_individual_requests.to_s |
| 136 | + enable_individual_requests.to_s, |
| 137 | + providing_diapers[:value], # Technically not part of the partner_settings partial, but comes at the end of the export |
| 138 | + providing_period_supplies[:value] |
140 | 139 | ] |
141 | 140 | } |
142 | 141 |
|
|
158 | 157 | primary_contact_email: nil |
159 | 158 | )) |
160 | 159 |
|
| 160 | + # The agency_information and settings sections contain information stored on the partner and not the |
| 161 | + # profile, so they won't be completely empty |
161 | 162 | expected_values = [ |
162 | 163 | partner.name, |
163 | 164 | partner.email, |
| 165 | + notes, |
164 | 166 | "", # Columns from the agency_information partial |
165 | 167 | "", |
166 | | - ", ", |
167 | 168 | "", |
168 | 169 | "", |
169 | 170 | "", |
170 | | - ", ", |
171 | 171 | "", |
172 | 172 | "", |
173 | 173 | "", |
174 | | - notes, |
175 | 174 | "", |
176 | | - providing_diapers[:value], |
177 | | - providing_period_supplies[:value], |
| 175 | + "", |
| 176 | + "", |
178 | 177 | "", # Columns from the media_information partial |
179 | 178 | "", |
180 | 179 | "", |
181 | 180 | "", |
182 | | - "".to_s, |
| 181 | + "", |
183 | 182 | enable_quantity_based_requests.to_s, # Columns from the partner_settings partial |
184 | 183 | enable_child_based_requests.to_s, |
185 | | - enable_individual_requests.to_s |
| 184 | + enable_individual_requests.to_s, |
| 185 | + providing_diapers[:value], |
| 186 | + providing_period_supplies[:value] |
186 | 187 | ] |
187 | 188 |
|
188 | 189 | get partners_path(partner, format: response_format) |
|
210 | 211 | end |
211 | 212 |
|
212 | 213 | context "with served counties" do |
| 214 | + before do |
| 215 | + organization.update(partner_form_fields: organization.partner_form_fields += ["area_served"]) |
| 216 | + end |
| 217 | + |
213 | 218 | it "returns them in correct order" do |
214 | 219 | county_1 = create(:county, name: "High County, Maine", region: "Maine") |
215 | 220 | county_2 = create(:county, name: "laRue County, Louisiana", region: "Louisiana") |
|
222 | 227 |
|
223 | 228 | csv = CSV.parse(response.body, headers: true) |
224 | 229 |
|
225 | | - expect(csv[0]["Counties Served"]).to eq("laRue County, Louisiana; Ste. Anne County, Louisiana; High County, Maine") |
| 230 | + expect(csv[0]["Area Served"]).to eq("laRue County, Louisiana; Ste. Anne County, Louisiana; High County, Maine") |
226 | 231 | end |
227 | 232 | end |
228 | 233 |
|
|
259 | 264 | let(:name_2) { "Jane Doe" } |
260 | 265 | let(:email_2) { "jane@doe.com" } |
261 | 266 | let(:notes_2) { "Some notes" } |
262 | | - let(:providing_diapers_2) { {value: "N", index: 22} } |
263 | | - let(:providing_period_supplies_2) { {value: "N", index: 23} } |
264 | | - |
265 | 267 | let(:agency_type_2) { :other } # Columns from the agency_information partial |
266 | 268 | let(:other_agency_type_2) { "Another Agency Name" } |
267 | 269 | let(:agency_mission_2) { "agency_mission" } |
|
283 | 285 | let(:enable_quantity_based_requests_2) { true } # Columns from the partner_settings partial |
284 | 286 | let(:enable_child_based_requests_2) { true } |
285 | 287 | let(:enable_individual_requests_2) { true } |
| 288 | + let(:providing_diapers_2) { {value: "N", index: 22} } |
| 289 | + let(:providing_period_supplies_2) { {value: "N", index: 23} } |
286 | 290 |
|
287 | 291 | it "orders partners alphaetically" do |
288 | 292 | get partners_path(partner, format: response_format) |
|
293 | 297 | [ |
294 | 298 | partner_2.name, |
295 | 299 | partner_2.email, |
296 | | - "#{I18n.t "partners_profile.other"}: #{other_agency_type_2}", # Columns from the agency_information partial |
| 300 | + notes_2, |
| 301 | + I18n.t("partners_profile.other").to_s, # Columns from the agency_information partial |
| 302 | + other_agency_type_2.to_s, |
297 | 303 | agency_mission_2, |
298 | 304 | "#{agency_address1_2}, #{agency_address2_2}", |
299 | 305 | agency_city_2, |
|
303 | 309 | program_city_2, |
304 | 310 | program_state_2, |
305 | 311 | program_zip_code_2.to_s, |
306 | | - notes_2, |
307 | | - "", # no counties |
308 | | - providing_diapers_2[:value], |
309 | | - providing_period_supplies_2[:value], |
310 | 312 | agency_website_2, # Columns from the media_information partial |
311 | 313 | facebook_2, |
312 | 314 | twitter_2, |
313 | 315 | instagram_2, |
314 | 316 | no_social_media_presence_2.to_s, |
315 | 317 | enable_quantity_based_requests_2.to_s, # Columns from the partner_settings partial |
316 | 318 | enable_child_based_requests_2.to_s, |
317 | | - enable_individual_requests_2.to_s |
| 319 | + enable_individual_requests_2.to_s, |
| 320 | + providing_diapers_2[:value], |
| 321 | + providing_period_supplies_2[:value] |
318 | 322 | ] |
319 | 323 | ) |
320 | 324 | end |
|
0 commit comments