Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 2.61 KB

README.md

File metadata and controls

80 lines (56 loc) · 2.61 KB

Ruby Training Exercises: Enumerable

This a set of exercises which will help you imrpove your Ruby skills. It's intended to:

  • Learn language basics, specially Enumerable
  • Practice TDD using RSpec
  • Practice writing clean code

Intended for beginners and intermediate level developers.

Prerequisites

  • Basic Ruby and RSpec knowledge.
  • Running Ruby development environment

Get started

  1. Fork this repo
  2. Go to the repo folder
  3. Run ´bundle install´

Rules

  • Commit and push you're changes after completing each requirement
  • Every completed requirement should include it's corresponding tests
  • Use TDD to develop the requirements
  • Existing classes can be modified but no new classes should be added

Exercises

We want to build a phone book to display the names and phone numbers for our contacts. Although we will not build the phone book's UI we need to build a library which complies to the following requirements:

NOTE: Under the lib folder we already have the Contact and Phonebook classes.

  1. As a client I want a list of the phone book contacts' names so I can display them to the user

    Hint: define a method in the Phonebook class which returns an array filled with it's contacts' names.

  2. As a client I want a list of the phone book contacts' phone numbers so I can display them to the user

    Hint: define a method in the Phonebook class which returns an array filled with it's contacts' phone numbers.

  3. As a client I want a mapping of the phone book contacts' names to their phone numbers so I can display the contact's phone numbers under it's name

    Hint: define a method in the Phonebook class which returns an hash which keys are the contacts' name and which values are the contacts' phone numbers

  4. As a client I need to know if all the phone book contacts have phone numbers so I can warn the user about incomplete entries

    Hint: define a method in the Phonebook class which returns true if all contacts have phone numbers and false otherwise

  5. As a client I want a list of phone book contacts without phone numbers so I can show them to the user

    Hint: define a method in the Phonebook class which returns an array with contacts without phone numbers

Good luck!