Skip to content

Commit 5433806

Browse files
Hardcoded expected values for tests on partner export
1 parent 0faab1d commit 5433806

2 files changed

Lines changed: 247 additions & 373 deletions

File tree

spec/requests/partners_requests_spec.rb

Lines changed: 101 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -27,59 +27,33 @@
2727
let(:response_format) { 'csv' }
2828

2929
let!(:partner) do
30-
create(:partner, name:, email:, status: :approved, organization:, notes:, without_profile: true)
30+
create(:partner, name: "Leslie Sue", email: "leslie@sue.com", status: :approved, organization:, notes: "Some notes", without_profile: true)
3131
end
3232
let!(:profile) do
3333
create(:partner_profile,
3434
partner: partner,
35-
agency_type: agency_type, # Columns from the agency_information partial
36-
other_agency_type: other_agency_type,
37-
agency_mission: agency_mission,
38-
address1: agency_address1,
39-
address2: agency_address2,
40-
city: agency_city,
41-
state: agency_state,
42-
zip_code: agency_zipcode,
43-
program_address1: program_address1,
44-
program_address2: program_address2,
45-
program_city: program_city,
46-
program_state: program_state,
47-
program_zip_code: program_zip_code,
48-
website: agency_website, # Columns from the media_information partial
49-
facebook: facebook,
50-
twitter: twitter,
51-
instagram: instagram,
52-
no_social_media_presence: no_social_media_presence,
53-
enable_child_based_requests: enable_child_based_requests, # Columns from the partner_settings partial
54-
enable_individual_requests: enable_individual_requests,
55-
enable_quantity_based_requests: enable_quantity_based_requests)
56-
end
57-
let(:name) { "Leslie Sue" }
58-
let(:email) { "leslie@sue.com" }
59-
let(:notes) { "Some notes" }
60-
let(:agency_type) { :other } # Columns from the agency_information partial
61-
let(:other_agency_type) { "Another Agency Name" }
62-
let(:agency_mission) { "agency_mission" }
63-
let(:agency_address1) { "4744 McDermott Mountain" }
64-
let(:agency_address2) { "333 Never land street" }
65-
let(:agency_city) { "Lake Shoshana" }
66-
let(:agency_state) { "ND" }
67-
let(:agency_zipcode) { "09980-7010" }
68-
let(:program_address1) { "program_address1" }
69-
let(:program_address2) { "program_address2" }
70-
let(:program_city) { "program_city" }
71-
let(:program_state) { "program_state" }
72-
let(:program_zip_code) { 12345 }
73-
let(:agency_website) { "bosco.example" } # Columns from the media_information partial
74-
let(:facebook) { "facebook" }
75-
let(:twitter) { "twitter" }
76-
let(:instagram) { "instagram" }
77-
let(:no_social_media_presence) { false }
78-
let(:enable_quantity_based_requests) { true } # Columns from the partner_settings partial
79-
let(:enable_child_based_requests) { true }
80-
let(:enable_individual_requests) { true }
81-
let(:providing_diapers) { {value: "N", index: -2} }
82-
let(:providing_period_supplies) { {value: "N", index: -1} }
35+
agency_type: :other, # Columns from the agency_information partial
36+
other_agency_type: "Another Agency Name",
37+
agency_mission: "agency_mission",
38+
address1: "4744 McDermott Mountain",
39+
address2: "333 Never land street",
40+
city: "Lake Shoshana",
41+
state: "ND",
42+
zip_code: "09980-7010",
43+
program_address1: "program_address1",
44+
program_address2: "program_address2",
45+
program_city: "program_city",
46+
program_state: "program_state",
47+
program_zip_code: 12345,
48+
website: "bosco.example", # Columns from the media_information partial
49+
facebook: "facebook",
50+
twitter: "twitter",
51+
instagram: "instagram",
52+
no_social_media_presence: false,
53+
enable_child_based_requests: true, # Columns from the partner_settings partial
54+
enable_individual_requests: true,
55+
enable_quantity_based_requests: true)
56+
end
8357

8458
let(:expected_headers) {
8559
[
@@ -112,30 +86,30 @@
11286

11387
let(:expected_values) {
11488
[
115-
partner.name, # Technically not part of the agency_information partial, but comes at the start of the export
116-
partner.email,
117-
notes,
118-
I18n.t("partners_profile.other").to_s, # Columns from the agency_information partial
119-
other_agency_type.to_s,
120-
agency_mission,
121-
"#{agency_address1}, #{agency_address2}",
122-
agency_city,
123-
agency_state,
124-
agency_zipcode,
125-
"#{program_address1}, #{program_address2}",
126-
program_city,
127-
program_state,
128-
program_zip_code.to_s,
129-
agency_website, # Columns from the media_information partial
130-
facebook,
131-
twitter,
132-
instagram,
133-
no_social_media_presence.to_s,
134-
enable_quantity_based_requests.to_s, # Columns from the partner_settings partial
135-
enable_child_based_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]
89+
"Leslie Sue", # Technically not part of the agency_information partial, but comes at the start of the export
90+
"leslie@sue.com",
91+
"Some notes",
92+
I18n.t("partners_profile.other"), # Columns from the agency_information partial
93+
"Another Agency Name",
94+
"agency_mission",
95+
"4744 McDermott Mountain, 333 Never land street",
96+
"Lake Shoshana",
97+
"ND",
98+
"09980-7010",
99+
"program_address1, program_address2",
100+
"program_city",
101+
"program_state",
102+
"12345",
103+
"bosco.example", # Columns from the media_information partial
104+
"facebook",
105+
"twitter",
106+
"instagram",
107+
"false",
108+
"true", # Columns from the partner_settings partial
109+
"true",
110+
"true",
111+
"N", # Technically not part of the partner_settings partial, but comes at the end of the export
112+
"N"
139113
]
140114
}
141115

@@ -160,9 +134,9 @@
160134
# The agency_information and settings sections contain information stored on the partner and not the
161135
# profile, so they won't be completely empty
162136
expected_values = [
163-
partner.name,
164-
partner.email,
165-
notes,
137+
"Leslie Sue",
138+
"leslie@sue.com",
139+
"Some notes",
166140
"", # Columns from the agency_information partial
167141
"",
168142
"",
@@ -179,11 +153,11 @@
179153
"",
180154
"",
181155
"",
182-
enable_quantity_based_requests.to_s, # Columns from the partner_settings partial
183-
enable_child_based_requests.to_s,
184-
enable_individual_requests.to_s,
185-
providing_diapers[:value],
186-
providing_period_supplies[:value]
156+
"true", # Columns from the partner_settings partial
157+
"true",
158+
"true",
159+
"N",
160+
"N"
187161
]
188162

189163
get partners_path(partner, format: response_format)
@@ -233,92 +207,65 @@
233207

234208
context "with multiple partners do" do
235209
let!(:partner_2) do
236-
create(:partner, name: name_2, email: email_2, status: :invited, organization:, notes: notes_2, without_profile: true)
210+
create(:partner, name: "Jane Doe", email: "jane@doe.com", status: :invited, organization:, notes: "Some notes", without_profile: true)
237211
end
238212
let!(:profile_2) do
239213
create(:partner_profile,
240214
partner: partner_2,
241-
agency_type: agency_type_2, # Columns from the agency_information partial
242-
other_agency_type: other_agency_type_2,
243-
agency_mission: agency_mission_2,
244-
address1: agency_address1_2,
245-
address2: agency_address2_2,
246-
city: agency_city_2,
247-
state: agency_state_2,
248-
zip_code: agency_zipcode_2,
249-
program_address1: program_address1_2,
250-
program_address2: program_address2_2,
251-
program_city: program_city_2,
252-
program_state: program_state_2,
253-
program_zip_code: program_zip_code_2,
254-
website: agency_website_2, # Columns from the media_information partial
255-
facebook: facebook_2,
256-
twitter: twitter_2,
257-
instagram: instagram_2,
258-
no_social_media_presence: no_social_media_presence_2,
259-
enable_child_based_requests: enable_child_based_requests_2, # Columns from the partner_settings partial
260-
enable_individual_requests: enable_individual_requests_2,
261-
enable_quantity_based_requests: enable_quantity_based_requests_2)
215+
agency_type: :other, # Columns from the agency_information partial
216+
other_agency_type: "Another Agency Name",
217+
agency_mission: "agency_mission_2",
218+
address1: "4744 McDermott Mountain",
219+
address2: "333 Never land street",
220+
city: "Lake Shoshana",
221+
state: "ND",
222+
zip_code: "09980-7010",
223+
program_address1: "program_address1_2",
224+
program_address2: "program_address2_2",
225+
program_city: "program_city_2",
226+
program_state: "program_state_2",
227+
program_zip_code: 12345,
228+
website: "bosco.example", # Columns from the media_information partial
229+
facebook: "facebook_2",
230+
twitter: "twitter_2",
231+
instagram: "instagram_2",
232+
no_social_media_presence: false,
233+
enable_child_based_requests: true, # Columns from the partner_settings partial
234+
enable_individual_requests: true,
235+
enable_quantity_based_requests: true)
262236
end
263237

264-
let(:name_2) { "Jane Doe" }
265-
let(:email_2) { "jane@doe.com" }
266-
let(:notes_2) { "Some notes" }
267-
let(:agency_type_2) { :other } # Columns from the agency_information partial
268-
let(:other_agency_type_2) { "Another Agency Name" }
269-
let(:agency_mission_2) { "agency_mission" }
270-
let(:agency_address1_2) { "4744 McDermott Mountain" }
271-
let(:agency_address2_2) { "333 Never land street" }
272-
let(:agency_city_2) { "Lake Shoshana" }
273-
let(:agency_state_2) { "ND" }
274-
let(:agency_zipcode_2) { "09980-7010" }
275-
let(:program_address1_2) { "program_address1" }
276-
let(:program_address2_2) { "program_address2" }
277-
let(:program_city_2) { "program_city" }
278-
let(:program_state_2) { "program_state" }
279-
let(:program_zip_code_2) { 12345 }
280-
let(:agency_website_2) { "bosco.example" } # Columns from the media_information partial
281-
let(:facebook_2) { "facebook" }
282-
let(:twitter_2) { "twitter" }
283-
let(:instagram_2) { "instagram" }
284-
let(:no_social_media_presence_2) { false }
285-
let(:enable_quantity_based_requests_2) { true } # Columns from the partner_settings partial
286-
let(:enable_child_based_requests_2) { true }
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} }
290-
291238
it "orders partners alphaetically" do
292239
get partners_path(partner, format: response_format)
293240

294241
csv = CSV.parse(response.body)
295242

296243
expect(csv[1]).to eq(
297244
[
298-
partner_2.name,
299-
partner_2.email,
300-
notes_2,
301-
I18n.t("partners_profile.other").to_s, # Columns from the agency_information partial
302-
other_agency_type_2.to_s,
303-
agency_mission_2,
304-
"#{agency_address1_2}, #{agency_address2_2}",
305-
agency_city_2,
306-
agency_state_2,
307-
agency_zipcode_2,
308-
"#{program_address1_2}, #{program_address2_2}",
309-
program_city_2,
310-
program_state_2,
311-
program_zip_code_2.to_s,
312-
agency_website_2, # Columns from the media_information partial
313-
facebook_2,
314-
twitter_2,
315-
instagram_2,
316-
no_social_media_presence_2.to_s,
317-
enable_quantity_based_requests_2.to_s, # Columns from the partner_settings partial
318-
enable_child_based_requests_2.to_s,
319-
enable_individual_requests_2.to_s,
320-
providing_diapers_2[:value],
321-
providing_period_supplies_2[:value]
245+
"Jane Doe",
246+
"jane@doe.com",
247+
"Some notes",
248+
I18n.t("partners_profile.other"), # Columns from the agency_information partial
249+
"Another Agency Name",
250+
"agency_mission_2",
251+
"4744 McDermott Mountain, 333 Never land street",
252+
"Lake Shoshana",
253+
"ND",
254+
"09980-7010",
255+
"program_address1_2, program_address2_2",
256+
"program_city_2",
257+
"program_state_2",
258+
"12345",
259+
"bosco.example", # Columns from the media_information partial
260+
"facebook_2",
261+
"twitter_2",
262+
"instagram_2",
263+
"false",
264+
"true", # Columns from the partner_settings partial
265+
"true",
266+
"true",
267+
"N",
268+
"N"
322269
]
323270
)
324271
end

0 commit comments

Comments
 (0)