Install Factory Bot with Ruby on Rails
Vložit
- čas přidán 8. 07. 2021
- In this episode, you'll learn how to setup the factory_bot_rails gem and some basics about using factories with RSpec tests in a Ruby on Rails application.
#rails #rubyonrails - Jak na to + styl
Wow CJ. Thank you so much for this series! Rails doesn't get enough love and your content is truly a pillar for me. Thank you!
Clear understanding on the factory bot. Thank you
Can you create how the traits, associations work with it with the next episode. Waiting for the next demo.
I definitely want to dive deeper in factory bot. It’ll be at least a few weeks before I get to this tho!
Well explained, super helpful. Thankyou!
Thank you for content 🎉
Thank you so much :)
Your videos are amazing, but something that I'm really jealous of is your control of Vim...
can you do a video about has_and_belongs_to_many
in factorybot?
Excellent video ... A question.. how can I create a hash with factory...with traits to add additional attributes to principal factory hash..is that possible?
Thanks Pierre! I believe the factories with factory bot only return instances of those underlying models. I would likely create a custom HashFactory class that doesn't use factory bot, but instead exposes a class method `create` that allows you to pass in your own override properties. Perhaps even a making HashFactory the parent of some other sub classes like CarHashFactory < HashFactory or similar.
@@cjav_dev ah ok.. thanks a lot...
How do you handle a situation where you have a model with a very deep belongs_to association tree. In my case, the tree is 12 level deep and if I dont provide the belongs_to associated model in the factory, I get the ActiveRecord::RecordInvalid: Validation failed: XXXX must exist.