This API is used to manage information about pilots, their ships, and the cargo they transport across the known stretches of intergalactic federation space.
This documentation is meant to help you understand how best to utilise our system.
The full spec for this system can be found here
Requirements:
- Ruby 2.7.4 or higher. If you are using a newer version, remeber to change that in the Gemfile
- Rails 7.0.4
- Postgresql should be installed on the target machine
- Once you have the repository on your local machine, open the directory in your terminal and run
bundle install
- After installing the required libraries, the next command you should run is
rails db:create
to initialize the database - Run
rails db:migrate
to create the required tables in the database - Run
rails db:seed
to add in test data to the database - If all the above commands run successfully, then you can start the server with
rails s
Once the server is running, you can access the endpoints defined in the user documentation on the route localhost:3000/endpoint
where endpoint is the name of that endpoint. For instance localhost:3000/pilots
The system uses RSpec to run tests. The tests are defined in the spec folder. To run the tests, enter the following command in your terminal
bundle exec rspec spec
This will seed your test database and run all the tests.
If you want to run a specific test, you can use the command
bundle exec rspec spec/path/to/test
for instance
bundle exec rspec spec/models/pilot_spec.rb
Similarly, if you want to run a set of tests, say for the models, you pass the path to the folder containing that set of tests
bundle exec rspec path/to/directory