Thorney is a back-end API for beta.parliament.uk. It's built on Rails, and outputs JSON which is consumed by Augustus.
- Requirements
- Quick start
- Running the application
- Using Docker Compose to run both Thorney and Augustus
- Contributing
- License
Thorney requires the following:
- Ruby - click here for the exact version
- Bundler
git clone https://github.com/ukparliament/thorney.git
cd thorney
bundle install
bundle exec rake
To run the application locally, run:
bundle exec rails s
The application should now be available at http://localhost:3000.
By default, there is a service timeout of 5 seconds. This can be disabled by setting the DISABLE_TIMEOUT
environment variable to true
, like so:
DISABLE_TIMEOUT=true bundle exec rails s
Make sure to clone Thorney and Augustus into the same directory and then change into the directory that Thorney is in.
git clone https://github.com/ukparliament/thorney.git
git clone https://github.com/ukparliament/augustus.git
cd thorney
Your folder structure should look like this:
/example_folder
/thorney
/augustus
To run both Thorney and Augustus, you will need to run the following commands from within the Thorney directory. Set up the application using:
docker-compose build --no-cache
Start the application using:
docker-compose up
The application will then be available from http://localhost:5400/.
To ensure a clean test file, expected outcomes have been separated into fixture folders. To create and update these folders quickly SerializerFixtureHelper and IntegrationFixtureHelper were created. To create a serializer fixture, use the following method:
create_fixture(serializer, 'fixture')
The first argument is the instance of the thing being tested; the second is the name of the fixture file.
To create a integration fixture, use the following method:
create_fixture(response.body, 'show', 'current_mp')
The first argument is the body of the expected response, the second is the name of the method testes, and the third is the name of the fixture file.
If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.
- Fork the repository
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Ensure your changes are tested using Rspec
- Create a new Pull Request