Testing Your Rails App Models with RSpec


Part of Screencast Series: RSpec


Published December 2015

Test your model with your own RSpec

Models are the core of most applications and of course you want to have them thoroughly tested. Programmers consider models to be one of the simplest part of the app to start writing tests as they have few Rails-specific dependencies. After learning about loading sample data, you are ready to dive into writing some RSpec to test your model inside out! In this video you will learn about grouping specs into groups, introducing relations and a bunch of useful techniques to make your code more concise.

Source code for this video is available at https://github.com/learnable-content/RSpec-collection/tree/model_testing

SPONSORS
Free Setting Up Automated Testing with RSpec 18:48
Free Managing Sample Data with Fixtures and Factories 18:29
Testing Your Rails App Models with RSpec 17:06
Free Testing Views, Routes, and Helpers for Problems in Your Rails App 12:54
Free Ensure Functionality with RSpec Controller Testing 13:49
Free Feature Tests with RSpec: Simulate User Behavior and Test Your Ruby App 17:01

Comments

Have your say! or become a member now to take part in the discussion

Loading...
Meet your instructor
Ilya Bodrov-Krukowski

Ilya is a lecturer at MATI-RSTU, senior engineer at Campaigner LLC and seasoned author at SitePoint. When Ilya is not working away on new projects or contributing to open source projects, he's expanding and refining his skills in HTML, CSS, jQuery, Angular, Backbone and Rails. You can read all about his work and development discoveries on his blog Radiant Wind.