TDD and BDD in Ruby

Get Started with Ruby TDD, BDD and Unit Testing from scratch in 5 days.

Video Error

We tried several times to play your video but there was an unforeseen error. We have notified our engineers.

Visit to check that Flash is enabled on your browser.

With Flash enabled, please try again in a few minutes or contact support.

  • Lectures 16
  • Video 5 Hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

Course Description

If you are just coming into the Ruby community, you might think "man; everyone here does unit testing and TDD already". But the truth is, that is very far from reality. Most people in Ruby seem to talk the talk, but very few that I've seen actually walk the walk.

Yes, many of them do have tests, but very few do things test driven. It's just very difficult without a guiding hand sometimes. So many developers slack off and write the tests after.

Worst, many developers do not know how to write anything but integration tests. There is lots of good stuff in integration tests, but they can also be very slow for a good feedback cycle.

Unit testing is necessary to learn, and doing things test driven can make you more productive in the long run )I discuss some numbers during the course).


I will teach you from zero how to write your first unit test with RSpec (and why RSpec) , all the way to making you a master of the craft with mock objects, stubs, and how to choose an isolation (mocking) framework.

You will also learn about making a continuous delivery solution and some patterns for getting started with a project on the right path.


What are the requirements?

  • A ruby environment set up on your machine.

What am I going to get from this course?

  • Over 16 lectures and 5 hours of content!
  • Learn Unit Testing from absolute zero
  • Learn advanced concepts like Mocks, Stubs and Fakes
  • Learn Advanced RSpec techniques
  • Learn Continuous Delivery Techniques

What is the target audience?

  • Developers of all experience levels

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Day 1 - Basic Building Blocks

What does the "Unit" in Unit Testing mean? Learn about the three end results of a "Unit" and how they relate to the three types of tests: Value Tests, State Tests and Interaction Tests with Mock Objects. Then we will jump into the basics of XUnit Frameworks.


Leanr how to set up a continuous testing solution using Guard and RSpec.


Now that we have continuous testing set up, we will work on the String Calculator Kata usiung RSpec.


Learn how to make your test code and production code simpler with some simple rules.


Common questions everyone asks when they see test driven development for the first time: Should I write many failing tests at the same time? what's the point of making the test fail first? these and more will be answered.

Section 2: Day 2 - Mocks, Stubs and Fakes

Learn the difference between Mocks, Stubs and Fakes, and use a hand written approach to creating Mock Objects.


Learn how to use Isolation (Mocking) frameworks and the difference between RSpec-Mocks, rr, Mocha and Bogus, and why Roy thinks Bogus is better.

Section 3: Day 3 - Advanced RSpec and Faking

We will now learn new features and advanced ideas to help clean up your RSpec files. Things like Subject, Let, specify, and more.


Learn how to fake class methods (statics) with Bogus.

5 pages

Please review the full day of Mock Objects videos before completing this lab.

Section 4: Day 4 - Acceptance Tests and Continuous Delivery

Learn how to use cucumber features to starting doing real Behavior Driven Development with your customer. BDD is all about communication, and here we learn the basics of writing the glue between what the customer or product owner writes, and what developers implement.


Learn how to use a gem like Capybara to test a simple sinatra application's main page.

Section 5: Day 5 - Continuous Delivery

Roy discusses how to start a project, and what goes into the first iteration. He then discusses the pyramid of resources, and how developers can say "no" by saying "yes" to features in the middle of an iteration.


In this talk we will set up a continuous integration solution for our project, that will run whenever we check things into github. We will talk about the different build configurations and build our first one.


Lastly, we will add dependancies between build configurations and make sure all builds use the same source and artifacts. This is the most important part about creating a build chain: making the build faster and source correct correct across the chain.

Section 6: Summary

Thank you very much for taking this course! You can learn more about unit testing at

Instructor Biography

Roy Osherove, Author of 'The Art Of Unit Testing'

I run TDD and team leadership classes for software developers.

Roy Osherove is one of the original ALT. NET organizers. He consults and trains teams worldwide on the gentle art of unit testing, test-driven development and how to lead software teams. He frequently speaks at international conferences on these topics and others.

Roy is the author of the book The Art of Unit Testing, and writes about subjects such as unit testing, TDD Team Leadership and agile development on his blog

Join the biggest student community


Hours of video content


Course Enrollments




Average Rating
  1. 5 Stars
  2. 4 Stars
  3. 3 Stars
  4. 2 Stars
  5. 1 Star
Ready to start learning?
Preview This Course