This is the registration system for the World Cube Association and is currently under development. For more info about the WCA visit the main repo here.
Run
docker compose up
This system is backend only. You need to run the WCA Frontend separately (currently hosted here). The backend is then available at localhost:8000
If you are running tests for development purposes (ie you want to run them multiple times and check passes/fails), do the following:
Run the server locally (see instructions above)
Open a command prompt in the registration-handler container:
2.1: Run docker ps
and note the {container-id} of the wca_registration_handler (eg, "4ac2f5ba2a83")
2.2: Run docker exec -it {container-id} bash
Inside the docker container, run bundle exec rspec
If you want to the test suite once-off, run
docker compose -f "docker-compose.test.yml" up wca_registration_handler --abort-on-container-exit
Connect to the docker container, then use one of the following:
bundle exec rspec
bundle exec rspec spec/requests/registrations/{file-name}
bundle exec rspec spec/requests/registrations/{file-name} -e "{success or fail}
We use RSwag to generate the API docs from the structure of our spec (test) files.
/swagger/v1
contains the swagger.yaml
files which define our API spec.swagger.yaml
is automatically generated when you run rake rswag:specs:swaggerize
in the docker container (see "Running the tests" for instructions to run a command in the docker container)NOTE: Using RSwag can make test definitions appear convoluted. For example:
response
block - you have to add a context
block before the response
block where the request is stubbed. If you have 4 consecutive tests with 4 different stubbed endpoints, you have to add a context
block before each test defined in a response
. It is annoying, but it is the price we pay for the convenience of RSwagTests are grouped by "context" into success/fail groups. Add the -e
flag to run tests matching search terms. So:
bundle exec rspec -e success
bundle exec rspec -e failure
https://medium.com/@josisusan/factorygirl-as-json-response-a70f4a4e92a0
We use a rake task to import registrations into the DynamoDB database. The import bypasses all validations, so it is possible to create registrations in invalid states this way.
aws ecs execute-command --cluster wca-registration-staging --task {task-id} --container staging-handler --interactive --command "/bin/bash"