Exercises, examples and other material relating to training module R211. This module is presented on Private Courses
and Specially Run Courses
|Articles and tips on this subject||updated|
|4681||Ruby testing with RSpec - a new example|
If you're wanting to test your Ruby classes, I recommend writing a test suite using RSpec - fresh example from today's course [here].
* Write the tests first - that's "test driven development" and then write the code to ensure that all the tests pass.
* If you find fault in you code later, add another ...
|4579||Behaviour and test driven development in Ruby using RSpec|
RSpec is a Test / Behaviourish Driven Development Gem for Ruby that you'll commonly find used in associaition with Rails, Gherkin, Cucumber, Watir, Selenium, Capybara ... but it can also be used stand alone. One of the big problems of starting to use it stand alone is to find an example which doesn't ...
|4544||RSpec - Ruby testing (stand alone example / no cucumber)|
RSpec can be used as a stand alone test environment for your Ruby program, as well as being used within Gherkin and Cucumber (see [here] for some details of that).
Installation as a Ruby Gem (you may need admin permissions):
gem install rspec
Run your program under the new executable rspec ...
|4386||Guide exercise to help you learn Gherkin, Cucumber and Rspec|
During today's Ruby course, I moved on to Cucumber and Gherkin very quickly - for a private course with delegates looking to using Behaviour Driven Development as the core of their work. Ruby's basics were covered first - variables, calculations, conditionals and loops. Then we moved on to functions, ...
|4383||Improved test in Cucumber with RSpec|
Articles in this "Introduction to Cucumber" series:
[link] - Installing Cucumber for Ruby
[link] - Hello Test Cucumber World
[link] - First real tests / second example
[link] - Improved tests with RSpec
pass and fail tests are very basic - so we can use other Ruby gems (such as Rspec) ...
Examples from our training material
|rs001|| First RSpec example (no cucumber)|
|rsx|| Class testing with rspec|
|several.rb|| Testing with multiple data values|
|tables.feature|| Behaviour definition - for a restaurant table|
|tables.rb|| Definition of tables derived from behaviour and test specs|
|tables_steps.rb|| Steps for implementing test behaviou for restaurant tables|
|testmatrix.rb|| Matrix of tests with rspec|
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from [here]
Topics covered in this module
The RSpec command.
Flexible and customizable reporting.
Extensible expectation language.
Built-in mocking/stubbing framework.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre.