Back End Lesson 2.3: Ruby Test Driven Development

Welcome to Lesson 2.3 of the Ruby on Rails Back End class. In this unit, we will learn:

  • Ruby enumerate
  • Ruby core | Ruby standard library
  • Ruby gems | Libraries

Back End Lesson 2.3 Goals

  • Understand how does Ruby enumerate works
  • Ruby’s core including structs, the kernel module, and more.
  • Ruby gems and how they are constructed, and implement them into your programs
  • In the assignment, gain familiarity with test driven development and practice more involved Ruby logic.

Curriculum

This is your curriculum for Back End Lesson 5.
**2.3.1 Ruby Enumerable (9 min) 2.3.2 Ruby Core and Standard Library (121 min) 2.3.3 Ruby Gems (48 min)

What is Test Driven Development?

In some development shops, automated tests are written first. The tests are written based on the specifications for the product and for the features that must be added. By doing test first development, you can ensure that you have comprehensive automated testing and that the developed features match the defined specifications. Once the tests are written, the actual code is written to make the test pass.

For your assignment, the tests have been written. When you run the tests, they will fail until you write the code needed to make them pass, which is how you know that you have completed the assignment correctly. For several parts of the assignment, you need to extend the provided tests so as to test additional features. For example, for 02_calculator, the tests for multiply, power, and factorial are not present. You need to edit calculator_spec.rb to add expect statements for the multiply, power, and factorial methods. Then you modify calculator.rb so that it satisfies the tests. This way you learn to write the test cases, a valuable skill.

Entry level development jobs often consist of the creation of automated tests, so being able to write them is a valuable skill. We will write automated tests in the Rails section of this course.

Assignments

Your assignment for Lesson 2.3 can be found here. This is a longer assignment. Start it at the start of the week, so that you have time to finish.

Your mindset curriculum assignment can be found here.

This site needs some love. Come contribute; we're open to contributors! Come lend a hand!