From the course: Ruby: Testing with RSpec
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Target code and the spec file - Ruby Tutorial
From the course: Ruby: Testing with RSpec
Target code and the spec file
- In this chapter, we'll learn the basics of using RSpec. We'll write simple tests for a simple bit of Ruby code. Let's begin by getting our files organized. The first thing we're going to need if we're going to write RSpecs for some code, is the code that we want to write it for. So I've got a very simple project here, called car_project. You can open that up and see that there's just two files in it, init.rb and a directory called lib that has a file, car.rb in it. I'm going to actually open that whole folder up in TextMate so we can take a look at it there. Now, it doesn't matter where this project is located. It can be absolutely anywhere on your computer, as long as we can navigate there from the command line. So let's also do that. Let's go into our command line. You can see that I'm in my user directory right now, and I'm just going to navigate into my desktop and into that car_project. So that's where I am now. Now, I'm inside that car_project directory. And now when I issue…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.