|
292 | 292 | expect(page).to have_link("document2.md") |
293 | 293 | end |
294 | 294 | end |
295 | | - |
296 | | - context "Mandatory fields validation" do |
297 | | - subject { all("input[type='submit'][value='Save Progress']").last.click } |
298 | | - |
299 | | - before do |
300 | | - find("button[data-bs-target='#agency_information']").click |
301 | | - within "#agency_information" do |
302 | | - fill_in "Agency Name", with: "Agency1" |
303 | | - select "Basic Needs Bank", from: "Agency Type" |
304 | | - fill_in "Address (line 1)", with: "123 Main St" |
305 | | - fill_in "City", with: "Metropolis" |
306 | | - fill_in "State", with: "CA" |
307 | | - fill_in "Zip Code", with: "90210" |
308 | | - end |
309 | | - find("button[data-bs-target='#agency_stability']").click |
310 | | - within "#agency_stability" do |
311 | | - fill_in "Program Name(s)", with: "Program 1" |
312 | | - fill_in "Program Description(s)", with: "Really great program" |
313 | | - end |
314 | | - end |
315 | | - |
316 | | - context "No social media filled" do |
317 | | - before do |
318 | | - find("button[data-bs-target='#media_information']").click |
319 | | - within "#media_information" do |
320 | | - fill_in "Website", with: "" |
321 | | - uncheck "No Social Media Presence" |
322 | | - end |
323 | | - end |
324 | | - |
325 | | - context "partner status is invited" do |
326 | | - before do |
327 | | - partner1.invited! |
328 | | - end |
329 | | - |
330 | | - it "displays success message" do |
331 | | - expect { |
332 | | - subject |
333 | | - }.to change { partner1.reload.updated_at } |
334 | | - |
335 | | - expect(page).to have_content("Details were successfully updated.") |
336 | | - end |
337 | | - end |
338 | | - |
339 | | - context "partner status is awaiting_review" do |
340 | | - before do |
341 | | - partner1.awaiting_review! |
342 | | - end |
343 | | - |
344 | | - it "displays validation errors" do |
345 | | - expect { |
346 | | - subject |
347 | | - }.not_to change { partner1.reload.updated_at } |
348 | | - |
349 | | - expect(page).to have_content("At least one social media field must be filled out or 'No social media presence' must be checked.") |
350 | | - end |
351 | | - end |
352 | | - |
353 | | - context "partner status is approved" do |
354 | | - before do |
355 | | - partner1.approved! |
356 | | - end |
357 | | - |
358 | | - it "displays validation errors" do |
359 | | - expect { |
360 | | - subject |
361 | | - }.not_to change { partner1.reload.updated_at } |
362 | | - |
363 | | - expect(page).to have_content("At least one social media field must be filled out or 'No social media presence' must be checked.") |
364 | | - end |
365 | | - |
366 | | - context "partner's organization one_step_partner_invite is true" do |
367 | | - before do |
368 | | - partner1.organization.update!(one_step_partner_invite: true) |
369 | | - end |
370 | | - |
371 | | - it "displays success message" do |
372 | | - expect { |
373 | | - subject |
374 | | - }.to change { partner1.reload.updated_at } |
375 | | - |
376 | | - expect(page).to have_content("Details were successfully updated.") |
377 | | - end |
378 | | - end |
379 | | - end |
380 | | - end |
381 | | - |
382 | | - context "Mandatory fields empty" do |
383 | | - before do |
384 | | - # find("button[data-bs-target='#agency_information']").click |
385 | | - within "#agency_information" do |
386 | | - fill_in "Agency Name", with: "" |
387 | | - select "", from: "Agency Type" |
388 | | - fill_in "Address (line 1)", with: "" |
389 | | - fill_in "City", with: "" |
390 | | - fill_in "State", with: "" |
391 | | - fill_in "Zip Code", with: "" |
392 | | - end |
393 | | - # find("button[data-bs-target='#agency_stability']").click |
394 | | - within "#agency_stability" do |
395 | | - fill_in "Program Name(s)", with: "" |
396 | | - fill_in "Program Description(s)", with: "" |
397 | | - end |
398 | | - end |
399 | | - context "partner status is invited" do |
400 | | - before do |
401 | | - partner1.invited! |
402 | | - end |
403 | | - |
404 | | - it "displays success message" do |
405 | | - expect { |
406 | | - subject |
407 | | - }.to change { partner1.reload.updated_at } |
408 | | - |
409 | | - expect(page).to have_content("Details were successfully updated.") |
410 | | - end |
411 | | - end |
412 | | - |
413 | | - context "partner status is awaiting_review" do |
414 | | - before do |
415 | | - partner1.awaiting_review! |
416 | | - end |
417 | | - |
418 | | - it "displays validation errors" do |
419 | | - expect { |
420 | | - subject |
421 | | - }.not_to change { partner1.reload.updated_at } |
422 | | - expect(page).to have_content("Missing mandatory fields: agency_name, agency_type, address1, city, state, zip_code, program_name, program_description") |
423 | | - end |
424 | | - end |
425 | | - |
426 | | - context "partner status is approved" do |
427 | | - before do |
428 | | - partner1.approved! |
429 | | - end |
430 | | - |
431 | | - it "displays validation errors" do |
432 | | - expect { |
433 | | - subject |
434 | | - }.not_to change { partner1.reload.updated_at } |
435 | | - expect(page).to have_content("Missing mandatory fields: agency_name, agency_type, address1, city, state, zip_code, program_name, program_description") |
436 | | - end |
437 | | - |
438 | | - context "partner's organization one_step_partner_invite is true" do |
439 | | - before do |
440 | | - partner1.organization.update!(one_step_partner_invite: true) |
441 | | - end |
442 | | - |
443 | | - it "displays success message" do |
444 | | - expect { |
445 | | - subject |
446 | | - }.to change { partner1.reload.updated_at } |
447 | | - |
448 | | - expect(page).to have_content("Details were successfully updated.") |
449 | | - end |
450 | | - end |
451 | | - end |
452 | | - end |
453 | | - end |
454 | 295 | end |
455 | 296 | end |
0 commit comments