Rspec Tutorial - vigoroom
Ch 00: Introduction Step 01: mkdir rspec_tutorial Step 02: cd rspec_tutorial Step 03: mkdir spec We are going to store our RSpec files in this folder. RSpec files are known as “specs”. If this seems confusing to you, you can think of a spec file as a test file. RSpec uses the term “spec” which is a short form for “specification”. Step 04: Let’s return to our Hello World code. Let’s return to our Hello World code. Open a text editor and add the following code − class HelloWorld def say_hello "Hello World!" end end describe HelloWorld do context “ When testing the HelloWorld class ” do it "should say 'Hello World' when we call the say_hello method" do hw = HelloWorld . new message = hw . say_hello expect ( message ). to eq "Hello World!" end end end Step 05: save this to a file named hello_world_spec.rb in the spec folder that you created above...