Thanks for the book. I really liked it. I think it provides a really good introduction to the topic of testing in rails. I already have some experience with testing so I was more interested in learning about best practices, anti patterns, etc, and was still able to get some learning points from the book. I would recommend it to anybody using Rails and I wish I had read it when I was starting out.
In the section concerning Using factories like fixtures I found the argument about using traits in order to avoid the shortcoming of fixtures to be confusing.
When you need to group differentiate models with specific functionalities, use traits to define the necessary attributes. That way, you can define one or more traits directly in the test, and only bring in the traits you need.
From what I understood from traits they are useful to avoid duplication when defining factories multiple aspects of a single object. I did not understand the argument about how they solve the fixture problem problem where important attributes for our test cases are defined outside the scope of our tests.
Hi,
Thanks for the book. I really liked it. I think it provides a really good introduction to the topic of testing in rails. I already have some experience with testing so I was more interested in learning about best practices, anti patterns, etc, and was still able to get some learning points from the book. I would recommend it to anybody using Rails and I wish I had read it when I was starting out.
In the section concerning Using factories like fixtures I found the argument about using traits in order to avoid the shortcoming of fixtures to be confusing.
From what I understood from traits they are useful to avoid duplication when defining factories multiple aspects of a single object. I did not understand the argument about how they solve the fixture problem problem where important attributes for our test cases are defined outside the scope of our tests.
Hope the feedback is helpful. Have a nice day.