Skip to content

Testing Binder Changes Locally

Joe McLaughlin edited this page Jun 5, 2024 · 1 revision

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.

Testing by Playing!

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!

Test Fixtures

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.

Creating New Fixtures

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:

  1. Create a new file at test/fixtures/[YOUR MODEL NAME].yml
  2. 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:
  ...
  1. 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.

Clone this wiki locally