A service for requesting social visits to a prisoner in England or Wales.
Production application is made available through GOV.UK and can be found at https://www.gov.uk/prison-visits
This a Ruby on Rails application that contains the public interface for requesting a social prison visit.
It is stateless and relies entirely on the prison visits booking API exposed by ministryofjustice/prison-visits-2.
The codebase was split from ministryofjustice/prison-visits-2, which previously was also responsible for serving the public interface.
- ministryofjustice/prison-visits-2. This a separate Ruby on Rails application that exposes prison information, slot availability, and allows booking and managing a visit. Details of the API methods consumed can be found in api.rb.
- If on a Mac install Xcode from the App Store
- direnv - for managing environment variables and storing credentials.
- (Optional) Transifex Client. ministryofjustice/prison-visits-public - for managing site translation. See additional documentation for setup and updating translations.
This application uses Ruby v3.2.2. Use RVM or similar to manage your ruby environment and sets of dependencies.
Note - You will need to spin up both ministryofjustice/prison-visits-public and ministryofjustice/prison-visits-2
-
Install gems (dependencies) locally. To do this you will need to first install Bundler
-
Install the
direnvpackagepvb2 $ brew install direnv
-
Enable direnv for you shell
Add the following line at the end of the
~/.bashrcfile:eval "$(direnv hook bash)"
Make sure it appears even after rvm, git-prompt and other shell extensions that manipulate the prompt.
Add the following line at the end of the
~/.zshrcfile:eval "$(direnv hook zsh)"
Add the following line at the end of the
~/.config/fish/config.fishfile:direnv hook fish | source
-
Create a .env file in the root of the folder and add any necessary environment variables. Load your environment variables into your current session ...
pvb-public $ direnv allow . -
In separate terminal windows start up ministryofjustice/prison-visits-2 and Sidekiq. The latter processes jobs in the background.
pvb-public $ bundle exec sidekiq pvb-public $ rails server -
In another terminal window start up ministryofjustice/prison-visits-public on port 4000
pvb-public $ rails server -p 4000
pvb-public $ rspec specDuring testing, the approach is to stub/mock API calls at the level of the API client, rather than at the HTTP level, since this is considerably cleaner, and decouples API changes. An example of this approach can be seen in prisoner_step_spec.rb.
The API client is then tested by recording real API interactions using VCR. The only tests recording VCR cassettes should be defined in api_spec.rb. If the API changes the appropriate cassettes should be deleted and re-recorded.
More information can be found in the GitHub Wiki.