Unit Tests

We will learn how to add tests to verify the Product model.

Data for testing

As discussed earlier, we need a user with one of the products to test the Product model and its interaction with the User model. Take a look at the fixture.yml of the Product model below.

Press + to interact
one:
title: MyString
price: 9.99
published: false
user: one
two:
title: MyString
price: 9.99
published: false
user: two

Note that this fixture does not use the attribute user_id, but rather ...