Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baqar-abbas/ruby-tdd
This project demonstrates testing in Ruby using Test Driven Development (TDD) approach using RSPEC as a testing tool.
https://github.com/baqar-abbas/ruby-tdd
Last synced: about 20 hours ago
JSON representation
This project demonstrates testing in Ruby using Test Driven Development (TDD) approach using RSPEC as a testing tool.
- Host: GitHub
- URL: https://github.com/baqar-abbas/ruby-tdd
- Owner: baqar-abbas
- License: mit
- Created: 2023-08-03T16:37:08.000Z (over 1 year ago)
- Default Branch: dev
- Last Pushed: 2023-08-03T21:25:50.000Z (over 1 year ago)
- Last Synced: 2023-08-03T22:40:07.495Z (over 1 year ago)
- Language: Ruby
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
TDD with Ruby
Created three unit tests using Rspec with mocks with the goal of practice and fully understand TDD concept
# 📗 Table of Contents
- [📖 About the Project](#about-project)
- [🛠 Built With](#built-with)
- [Tech Stack](#tech-stack)
- [Key Features](#key-features)
- [💻 Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Usage](#Usage)
- [Tests](#tests)
- [👥 Authors](#authors)
- [🔮 Future features](#future-features)
- [🤝 Contributing](#contributing)
- [⭐️ Show your support](#support)
- [🙏 Acknowledgements](#acknowledgements)
- [📝 License](#license)This project is done as part of Microverse program as a collaborative Project. We have done test-driven development (TDD), writing tests first and then creating the methods.
### Key Features
1. First we have created the test for every method:- Create a method called `factorial` that takes one argument, an integer `N`, and returns the [factorial](https://en.wikipedia.org/wiki/Factorial) for that number. The factorial is the multiplication of all integers from 1 to `N` 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.
- Create a method called `reverse` that takes one argument, a string `word`, and returns `word` reversed (e.g. if `word` is `"hello"` it returns `"olleh"`).
- Create a method called `fizzbuzz` that takes one argument, an integer `N`, and returns a string. The returned string is constructed following these rules:
- When `N` is divisible by 3, return `"fizz"`.
- When `N` is divisible by 5, return `"buzz"`.
- When `N` is divisible by 3 and 5, return `"fizzbuzz"`.
- Any other case, return `N` as a string (e.g. say `N` is `7` then return `"7"`).
- Remember to start with tests for all of the methods described above. Your commit history should prove that you have used TDD.2. Second we have created the class Solver with the mentioned methods.
To get a local copy up and running, follow these steps.
### Prerequisites
In order to run this project you need:
Install ruby. To install ruby in your machine you can follow the steps listed in the [Ruby installation instructions guide](https://github.com/microverseinc/curriculum-ruby/blob/main/simple-ruby/articles/ruby_installation_instructions.md)### Setup
Clone this repository to your desired folder:
```
cd ruby-TDD
git clone [email protected]:myaccount/my-project.git
```### Usage
To start the app, run the command:
```
ruby main.rb
```### Tests
To start the app, run the command:
```
rspec spec
```👤 **Andrea Rivas**
- GitHub: [@rivasbolinga](https://github.com/rivasbolinga)
- LinkedIn: [Andrea Rivas](https://www.linkedin.com/in/andrearivaspalacios/)👤 **Baqar Abbas**
- GitHub: [@Baqar](https://github.com/baqar-abbas)
- Twitter: [@BaqarAbbas9](https://twitter.com/BaqarAbbas9)
- LinkedIn: [Baqar Abbas](https://www.linkedin.com/in/baqar-abbas/)- Create more methods.
Contributions, issues, and feature requests are welcome!
Feel free to check the [issues page](../../issues/).
If you like this project give it a star 🌟🌟🌟
I would like to thank **![Microverse](https://img.shields.io/badge/Microverse-blueviolet)** and my partner [Andrea](https://github.com/rivasbolinga?tab=repositories) for his participation in this project.
This project is [MIT](https://github.com/baqar-abbas/ruby-TDD/blob/dev/LICENSE) licensed.