This project implements a String Calculator following the TDD (Test-Driven Development) methodology. The calculator can add numbers provided in a string format, handle custom delimiters, and throw exceptions for negative numbers.
- Add Method: Takes a string of numbers separated by commas or new lines and returns their sum.
- Custom Delimiters: Supports custom delimiters specified at the beginning of the string.
- Negative Numbers: Throws an exception if negative numbers are provided, listing all negative numbers in the exception message.
- Ruby (version 2.7.0)
- Rails (version 6.1.7)
-
Clone the repository:
https://github.com/nidhi-soni1104/calculator.git cd string_calculator
-
Install the required gems:
bundle install
-
Set up the database (if applicable):
rails db:create rails db:migrate
To run the tests, use the following command:
rails test