This app is used by staff in the courts and tribunals to enter data regarding help with fees applications, record the decision, and collect statistics.
- Authentications via Devise / CanCanCan
- Rspec features, not cucumber
- Slim templating language
- JavaScript in preference to Coffeescript
We are using Redis for step back navigation link. You will need to run a redis-server in order for the application to work correctly. We are using mock_redis in rspec to make it work it tests.
Model FeatureSwitching have following attributes: feature_key, activation_time, office_id, enabled. When apply you can "schedule" a feature to be active from a certain date or for specific office. Feature switching table is managed manually from a rails console for now.
Run this in your localhost to enable UCD changes: FeatureSwitching.create(feature_key: 'band_calculation', enabled: true)
There is a gem called Bullet. If you want to check N+1 queries in development mode, you can uncomment Bullet related lines in development.rb
We need to keep an eye on the results of DWP checks. When the API is down the service will disable benefit related applications. Then we re-run failed checks in 10 minutes intervals to see if the API is back again. We are not using standard CRON table because Kubernetes have a bug. So we are using delayed cron job that has the schedule in DB table. These tasks are checked by
rake jobs:work
that needs to run on the background, currently set up in rub.sh :
rake jobs:work &
To set it up (if there is no record in DB) run this in rails console:
BenefitCheckRerunJob.delay(cron: '*/10 * * * *').perform_now
Runs every 5 minutes
DwpReportStatusJob.delay(cron: '*/5 * * * *').perform_now
Runs 10 minutes past midnight
HmrcDataPurgeJob.delay(cron: '10 0 * * *').perform_now
Runs every day at 1am
PersonalDataPurgeJob.delay(cron: '0 1 * * *').perform_now
Runs every day at 1am
AbandonedApplicationPurgeJob.delay(cron: '0 1 * * *').perform_now
Runs every day at 2am
OldFileExportPurgeJob.delay(cron: '0 2 * * *').perform_now
You will need to install govuk-frontend library
npm install --save govuk-frontend
Mimemagic gem has a dependency so you need to install this on your machine first
brew install shared-mime-info.
There is a rake task that takes email, password and role
rake user:create
If you want to add any custom options, use the below as an example:
rake "user:create[[email protected], 12345678900, admin, name]"
Note: the quotes around the task are important!
There is a rake task that creates the report
rake "reports:applicants[2021, 2022]"
this will generate a zip file applicants-2021-2022-fy.csv.zip
There is a rake task that creates the report
rake "reports:raw_data_extract[2021-01-01, 2022-12-31]"
this will generate a zip file raw_data-1-1-2021-31-12-2022.csv.zip
Follow the official guides to setup your local env
Run the specs in parallel
RAILS_ENV=test bundle exec rake parallel:spec
Run the cucumber features in parallel
CAPYBARA_SERVER_PORT=random bundle exec rake parallel:features
Cucumber report is enabled now. At the end of the test run you should see a link to a website. When you run tests in parallel it will generate report per process so if you want to see one report only you should run test directly without parallel functionality.
Deployment versions trigger: 7