Basic rspec Ruby on Rails model specs

Тәжірибелік нұсқаулар және стиль

In this episode you'll learn some basics for testing simple methods on Ruby on Rails models.
#rails #rubyonrails

Пікірлер: 15

  • @tomdringer985
    @tomdringer9856 ай бұрын

    Really enjoying these testing videos. ?You make it all crystal clear. Thank you!

  • @viveknaik6798
    @viveknaik6798 Жыл бұрын

    Extremely well done! I watch with 75% speed.

  • @lucydelaluna
    @lucydelaluna11 ай бұрын

    Great tutorial! Thank you so much.

  • @martinkarkovich3037
    @martinkarkovich30372 жыл бұрын

    very detailed explanations!

  • @john.dough.
    @john.dough. Жыл бұрын

    awesome! Thanks for sharing

  • @CHACHANUS
    @CHACHANUS2 жыл бұрын

    great video !!!! in the next video for complex tests can you show examples how i can refactor long tests , and , if is possible create a function or method when i have to build factories with same format, example form4=build.... and these lines are repeated along my tests? . would be nice if teach us some about code coverage with simplecov... thanks in advance,,, channels like yours keep Rails alive.

  • @mutebiugofficial8827
    @mutebiugofficial8827 Жыл бұрын

    How can I test for regular expressions with rspec and shoulda matchers.

  • @farsiteguide2735
    @farsiteguide27356 ай бұрын

    Tnx for tutorials, but where can I find form4tracker build videos?

  • @judisjeevan4908
    @judisjeevan4908 Жыл бұрын

    Hi CJ. Which Vim theme are you using? Also which terminal? Whether it is iTerm or Terminal in mac?

  • @cjav_dev

    @cjav_dev

    Жыл бұрын

    One dark is the theme in iTerm. I also set some custom colors on iTerm

  • @dbsmith3974
    @dbsmith39742 жыл бұрын

    is the schema information automatically added to your model file or do you manually add that information?

  • @cjav_dev

    @cjav_dev

    2 жыл бұрын

    When you create the model and a migration, and run the migrations, the schema is automatically updated. This is a solid question and something I totally glossed over. Will try to cover this better in the future.

  • @dbsmith3974

    @dbsmith3974

    2 жыл бұрын

    @@cjav_dev Im familiar with the schema being created, but Ive never come across the table details in the model like you have here. I even ran a rails g rspec:mode dummy name born_at:integer to see if it was something I may have missed but nothing was there

  • @cjav_dev

    @cjav_dev

    2 жыл бұрын

    oh! so if you run `rails g rspec:model Dummy` that'll create the spec file and the factory, but both will be empty, even if the schema has columns. If you run `rails g rspec:model Dummy born_at:integer` that should create the same spec file, but the factory should have a new born_at thing setup for you. In practice, when you generate new models like: `rails g model Dummy born_at:datetime` that'll generate the model, migration, spec, and it'll also add born_at to your factory, which is super handy :)

  • @kang_marvin

    @kang_marvin

    Жыл бұрын

    It's a gem called Annotate.

Келесі