Skip to content

kusiLaw/TDD-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📗 Table of Contents

📖 Test Driven Development Project

In this project we implemented a class with some methods using test-driven development (TDD). The idea is to write tests first and then the code.

🛠 Built With

Tech Stack

Describe the tech stack and include only the relevant sections that apply to your project.

Language
Linter
Test Library

Key Features

We created a class called Solver with the following methods:

  • factorial that takes one argument, an integer num, and returns the factorial for that number. The factorial is the multiplication of all integers from 1 to num and has the special case that the factorial of 0 is 1. This method only accepts 0 and positive integers, so if a negative integer is given it should raise an exception.
  • reverse that takes one argument, a string word, and returns word reversed (e.g. if word is hello it returns olleh).
  • fizzbuzz that takes one argument, an integer num, and returns a string. The returned string is constructed following these rules:
    • When num is divisible by 3, return fizz.
    • When num is divisible by 5, return buzz.
    • When num is divisible by 3 and 5, return fizzbuzz.
    • Any other case, return num as a string (e.g. say num is 7 then return 7).

(back to top)

💻 Getting Started

Prerequisites

In order to run this project you need:

  • Install Ruby on your computer (machine)

Setup

Clone this repository to your desired folder:

  git clone git@github.com:kusiLaw/TDD-project.git
  cd TDD-project

Install

Install this project with:

  gem install bundler
  bundle install

Usage

To run the project, execute the following command:

  ruby solver.rb

Run tests

In order to run unit tests on the local machine Rspec gem should be installed

  • run in the terminal
    gem install rspec
  • After installation run
    rspec spec/file_name.rb
  • If you are interested in running all the tests together then
    rspec spec
  • For more information please visit RubyGuides.

(back to top)

👥 Authors

👤 Kwaleyela Musilizo Ikafa

GitHub LinkedIn Twitter

👤 Praises Tula

GitHub LinkedIn Twitter

Gmail AngelList

(back to top)

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

(back to top)

⭐️ Show your support

Give a ⭐️ if you like this project!

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages