# Recurly Subscription Testing Progress ## Goal Document current Recurly/subscription architecture and close test gaps for subscription lifecycle behavior during Rails 8 migration. ## Status - [x] Create task tracker - [x] Sweep code paths for Recurly/subscription behavior (`web` + `ruby`) - [x] Draft architecture and current-test documentation - [x] Draft gap-based test plan - [x] Add first request specs for API subscription/payment flow - [x] Add and run live Recurly internet integration tests (opt-out) - [x] Revive legacy Recurly `xdescribe` suites and make them pass - [ ] Add ruby specs for `RecurlyClient#sync_subscription` and hourly job paths - [ ] Add browser-level flow coverage for payment-first vs plan-first UX - [ ] Update docs with final test references ## Notes - Started: 2026-03-02 - Existing subscription-focused specs are heavily stale; key suites are currently disabled with `xdescribe`: - `ruby/spec/jam_ruby/recurly_client_spec.rb` - `ruby/spec/jam_ruby/models/user_subscriptions_spec.rb` - Existing active webhook coverage is present in both `ruby` model spec and `web` request spec. - Added and validated new request coverage: - `web/spec/requests/api_recurly_subscription_flow_spec.rb` - Verified with `cd web && bundle exec rspec spec/requests/api_recurly_subscription_flow_spec.rb` (3 examples, 0 failures). - Added and validated live Recurly API coverage: - `ruby/spec/jam_ruby/integration/recurly_live_integration_spec.rb` - Verified with `cd ruby && bundle exec rspec spec/jam_ruby/integration/recurly_live_integration_spec.rb` (2 examples, 0 failures). - Verified opt-out path with `SKIP_LIVE_RECURLY=1` marks examples pending (no failures). - Revived legacy suites: - `ruby/spec/jam_ruby/recurly_client_spec.rb` (`xdescribe` -> `describe`) - `ruby/spec/jam_ruby/models/user_subscriptions_spec.rb` (`xdescribe` -> `describe`) - Modernized stubbing syntax and updated expired card-year fixture values. - Added explicit live Recurly credential setup inside those suites. - Fixed real code issue discovered by revived tests: `RecurlyClient#update_account` used removed API (`update`) and now uses `update_attributes`. - Verified: - `cd ruby && bundle exec rspec spec/jam_ruby/recurly_client_spec.rb` (6 examples, 0 failures) - `cd ruby && bundle exec rspec spec/jam_ruby/models/user_subscriptions_spec.rb` (15 examples, 0 failures) - Credential check findings: - `test.rb` Recurly test credentials (`jamkazam-test`) are stale (`HTTP Basic: Access denied`). - Working combo found in repo: key `55f2...` with subdomain `jamkazam-development`.