Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harrison-broadbent/hotdoc-api-spec
https://github.com/harrison-broadbent/hotdoc-api-spec
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/harrison-broadbent/hotdoc-api-spec
- Owner: harrison-broadbent
- Created: 2023-08-24T00:51:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-24T01:00:07.000Z (over 1 year ago)
- Last Synced: 2024-10-14T00:26:06.046Z (2 months ago)
- Language: Ruby
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A Rails 7 app in API only mode, al la Hotdoc techincal interview. I've been playing around a bit with JSON responses and request specs, since I wasn't too familiar with them.
### What's here
- Added the appointment model between patient and clinics
- See `/spec/requests/` for api specs
- Rather than Devise, theres a custom `login_as_patient` helper which just sets the patient id in the session cookie. This is used by ApplicationController to set the `current_patient`### Requests vs Controller specs
In the interview we mentioned controller vs request specs. I didn't have a great answer so I've done some research. As of 2019, the RSpec team officially stated that **controller specs are now obsolete**, so there's that.
Request specs have the benefit of testing the controller flow, _plus_ the router + middleware + request / response stack of your app. Essentially, you can test more of the app while writing the same tests, which in most cases is an easy win.
As of Rails 5, request specs are actually _significantly faster_ than controller specs too. Essentially you can test _more_ of your app in _less_ time!