Test First Ruby -- RSpec 3 Edition
This is modified version of test-first.org's learn ruby project. See testfirst.org/learn_ruby for more information about how this will work. These test-first Ruby challenges have been forked from https://github.com/alexch/learn_ruby and updated to use RSpec 3 instead of RSpec 2.
Set up instructions
- Fork this repo
- Clone your version of the repo to your local machine
- On your local machine,
cdinto the root folder of this repo in your terminal
bundle installto install all the gems this project needs.
Getting started with the exercises
To work through the first exercise, follow this process
00_hellofrom the root folder of this project
rake, to run the tests. It will fail with the following error:
Failures: 1) the hello function says hello Failure/Error: expect(hello).to eq("Hello!") NameError: undefined local variable or method `hello' for #<RSpec::ExampleGroups::TheHelloFunction:0x007fa1221408f0> # ./00_hello/hello_spec.rb:106:in `block (2 levels) in <top (required)>'
- Read the failure output carefully and write the code that will make it pass
- Run the tests again with
- This will output that one test has passed and another test failure, write the code to make the next test pass.
- Continue this process until all tests pass (when they are green) you have now completed the exercise.
- Do this for all the exercises in this project
- To get hints and tips about each exercise, view the
index.htmlfile that is included in each exercise folder
Basically, this is "error-driven development"... you'll keep running tests, hitting error messages, fixing those messages, running more tests... It is meant to not only test your Ruby skills but also get you comfortable seeing big scary looking stack traces and error messages. Most of the development you do at first will be just like this. In fact, most of all development is error-driven. So get comfortable with it!
Don't name any of your directories with spaces in them! It will give you horribly frustrating error messages and code hates dealing with spaces. For instance:
# BAD: /Documents/My Homework/ruby # GOOD: /Documents/my_homework/ruby
This is forked from https://github.com/alexch/learn_ruby, its original creator.