Unit Tests
We will learn how to add tests to verify the Product model.
We'll cover the following...
We'll cover the following...
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.
one:title: MyStringprice: 9.99published: falseuser: onetwo:title: MyStringprice: 9.99published: falseuser: two
Note that this fixture does not use the attribute user_id, but rather user. This means ...