Skip to content

Conversation

@AudTheCodeWitch
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #6313

What changed, and why?

This PR is a comprehensive refactor of the test suite for the Case Court Reports feature. The original spec file was refactored to be faster, more reliable, and easier to maintain.

Key Changes:

  • Refactored spec/system/case_court_reports/index_spec.rb:

    • Added "Happy Path" Test: Added a full, end-to-end system test that selects a case, generates a report, waits for the background job, and confirms the file is successfully attached in the database.
    • Added comprehensive tests for case visibility in the autocomplete dropdown for all three user roles (Volunteer, Supervisor, and Admin).
    • Consolidated Supervisor and Admin autocomplete tests into a shared_example (a user with organization-level case visibility in autocomplete) to reduce duplication.
    • Broke up large, multi-assertion tests into smaller, focused tests (e.g., for default dates, error states, and transition labels). Note: I didn't observe any increase in how long it took to run the tests
    • Resolved all outstanding RuboCop warnings by removing unused let statements and safely disabling warnings for complex but necessary test setup.
  • Improved Test Organization:

    • Moved tests verifying the download link on the case details page from index_spec.rb to spec/system/casa_cases/show_spec.rb.
    • Added new request specs for date filtering to spec/requests/case_court_reports_spec.rb.
    • Extracted helper methods into spec/support/case_court_report_helpers.rb.

This PR completes all outstanding test work for this feature.

How is this tested? 💖💪

  • RSpec system specs in spec/system/case_court_reports/index_spec.rb.
  • RSpec system specs in spec/system/casa_cases/show_spec.rb.
  • RSpec request specs in spec/requests/case_court_reports_spec.rb.
  • All specs passing (ran 100+ times with no flakes!)

Feelings gif

Parks and Rec's Tom Haverford saying, "#dunzo"

… reporting

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…d click actions

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
… details report access specs

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…port generation simulation

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…port generation simulation

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
… improve timeout settings

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
… for clarity

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
… for clarity

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…s in index spec

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…ors, and admins

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…r roles

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
… for user roles

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…r roles

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…sibility specs

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…c.rb

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…ngth cop

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
Signed-off-by: Audrea Cook <audrea@codewitch.dev>
… consistency

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
…orts

Signed-off-by: Audrea Cook <audrea@codewitch.dev>
@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Oct 29, 2025
@AudTheCodeWitch AudTheCodeWitch changed the title Acook/6313/update case court reports index spec 6313 - Case Court Reports Index Spec Overhaul Oct 30, 2025
@AudTheCodeWitch
Copy link
Contributor Author

@compwron, any chance you could get your eyes on this pr and/or add the hacktoberfest-accepted label this weekend? Happy to address any comments/code review later... I was just hoping to wrap up this year's Hacktoberfest. 😊

@compwron
Copy link
Collaborator

compwron commented Nov 5, 2025

I'm sorry I missed this for hacktoberfest!! :( It looks great :)

@compwron compwron merged commit 0eb8383 into rubyforgood:main Nov 5, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Pull requests that update Ruby code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System Test Overhaul spec/system/case_court_reports/index_spec.rb

2 participants