This Ruby project is a solution to the London Transportation Challenge. It simulates a simple transportation system in London, calculating fares for trips between different stations and updating card balances accordingly. The project includes various Ruby classes for cards, stations, trips, and services to handle these operations.
This project was developed using Ruby version 3.2.2.
To run the example script that demonstrates the functionality of the transportation system, follow these steps:
-
Make sure you have Ruby installed on your system.
-
Open your terminal or command prompt.
-
Navigate to the project directory where the
example_script.rb
file is located. (It is inapp/scripts/
). -
Run the script by executing the following command:
ruby example_script.rb
The script will execute a series of example trips, displaying trip details, card balances, and fare calculations in the terminal. For example:
Tube Holborn to Earl’s Court (2.50)
328 bus from Earl’s Court to Chelsea (1.80)
Tube Chelsea to Wimbledon (3.20)
The total charge is 7.50
and the final card balance will be 22.50
To run the tests for this project using RSpec, follow these steps:
-
Open your terminal or command prompt.
-
Navigate to the project root directory.
-
Run the tests by executing the following commands:
bundle install rspec
This will run all the tests and display the results in the terminal.