Skip to content

Re-enable disabled spec for case_contacts#leave (GET /case_contacts/leave) #6913

@compwron

Description

@compwron

Background

spec/requests/case_contacts_spec.rb:165 has a disabled spec block:

xdescribe \"GET /leave\" do
  subject(:request) do
    get leave_case_contact_path
    response
  end

  it { is_expected.to redirect_to(case_contacts_path) }

  it \"redirects back to referer or fallback location\" do
    request
    expect(response).to redirect_to(case_contacts_path)
  end
end

Why it's disabled

The spec calls `leave_case_contact_path` (singular, no suffix), but the route is declared as:

# config/routes.rb:83
get \"case_contacts/leave\", to: \"case_contacts#leave\", as: \"leave_case_contacts_form\"

The actual path helper is `leave_case_contacts_form_path`, not `leave_case_contact_path`. The route was renamed/restructured at some point and the spec was disabled instead of updated.

The action itself still exists at `app/controllers/case_contacts_controller.rb:66`:

def leave
  redirect_back_to_referer(fallback_location: case_contacts_path)
end

What to do

  1. Replace xdescribe with describe.
  2. Update the path helper to leave_case_contacts_form_path.
  3. Verify both examples pass.
  4. While you're here: the second example duplicates the first (`is_expected.to redirect_to(case_contacts_path)` is the same assertion). Consider removing the `it { is_expected.to ... }` shorthand or merging.

Acceptance criteria

  • Spec block is enabled (`describe`, not `xdescribe`).
  • Both examples pass.
  • No remaining `xit`/`xdescribe` in this file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions