- Create a class called
Solver
. - Create a method called
factorial
that takes one argument, an integerN
, and returns the factorial for that number. The factorial is the multiplication of all integers from 1 toN
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 stringword
, and returnsword
reversed (e.g. ifword
is"hello"
it returns"olleh"
). - Create a method called
fizzbuzz
that takes one argument, an integerN
, 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. sayN
is7
then return"7"
).
- When
- Remember to start with tests for all of the methods described above. Your commit history should prove that you have used TDD.
To run the project locally do the following:
- Clone the project into your local machine:
git clone https://github.com/anuarshaidenov/TDD-project.git
- Change the working directory to the project's one:
cd TDD-project
- Install the gems using:
bundle install
- to run the tests type:
rspec
๐ค Yuriy Chamkoriyski
- GitHub: @Hombre2014
- Twitter: @Chamkoriyski
- LinkedIn: axebit
๐ค Anuar Shaidenov
- GitHub: @anuarshaidenov
- Twitter: @anuarnyi
- LinkedIn: Anuar Shaidenov
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a โญ๏ธ if you like this project!
This project is MIT licensed.