-
Notifications
You must be signed in to change notification settings - Fork 19
Testing Binder Changes Locally
It's really important that we test Binder changes locally before pushing changes to production, since otherwise we may end up adding buggy code to production and breaking Binder before or during Carnival (For more information about how bad this can be, ask your local Meg). Below is a non-exhaustive description of ways to test Binder locally.
The easiest (and most fun!) way to test Binder code is by playing around with it in a local development environment. Simply start up your local development server with rails s
and interact with Binder at http://localhost:3000/
. You can also test out how Binder looks for various users (SCC Members, Booth Chairs, Random Participants, etc.) by using the Development Participant Picker on the side of the homepage. Make sure everything works as intended before pushing code!
Binder in development uses test data in test fixtures to show how Binder would work using hand-made data. Fixtures are written using .yml files in test/fixtures
, and represent instances of models to be used in Binder development.
Generally, we want to have fixtures for each model we create in Binder. If you create a new model, create test data for the model:
- Create a new file at
test/fixtures/[YOUR MODEL NAME].yml
- Populate the file with information about the model instances you want to show up in local Binder, as shown below. You should try to at least have enough instances to test most ways the model could be used.
instance_1:
attribute_1: value_1
attribute_2: value_2
...
instance_2:
...
- Run
rails db:fixtures:load
to refresh the Binder's database with your new fixtures. If the command succeeds, your fixtures should be in your local Binder!
Read more about fixtures in Rails with the Rails documentation.