Install Factory Bot with Ruby on Rails

Sdílet
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

Komentáře • 12

  • @subem81
    @subem81 Před rokem +3

    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!

  • @dhrusoni1
    @dhrusoni1 Před 2 lety +5

    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.

    • @cjav_dev
      @cjav_dev  Před 2 lety

      I definitely want to dive deeper in factory bot. It’ll be at least a few weeks before I get to this tho!

  • @qonaahnurussalamah7098
    @qonaahnurussalamah7098 Před 2 lety +1

    Well explained, super helpful. Thankyou!

  • @tuchandra1729
    @tuchandra1729 Před rokem

    Thank you for content 🎉

  • @user-ki6cb6en9d
    @user-ki6cb6en9d Před 9 měsíci

    Thank you so much :)

  • @Cabugamer
    @Cabugamer Před měsícem

    Your videos are amazing, but something that I'm really jealous of is your control of Vim...

  • @haroldpepete
    @haroldpepete Před rokem +1

    can you do a video about has_and_belongs_to_many
    in factorybot?

  • @CHACHANUS
    @CHACHANUS Před 2 lety +1

    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?

    • @cjav_dev
      @cjav_dev  Před 2 lety

      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.

    • @CHACHANUS
      @CHACHANUS Před 2 lety

      @@cjav_dev ah ok.. thanks a lot...

  • @AlainPilon
    @AlainPilon Před 10 měsíci

    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.