Skip to content

A proposed back-end api for beta.parliament.uk

Notifications You must be signed in to change notification settings

naseberry/thorney

 
 

Repository files navigation

Thorney

Thorney is a back-end API for beta.parliament.uk. It's built on Rails, and outputs JSON which is consumed by Augustus.

Build Status Test Coverage License

Contents

Requirements

Thorney requires the following:

Quick start

git clone https://github.com/ukparliament/thorney.git
cd thorney
bundle install
bundle exec rake

Running the application

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

Using Docker Compose to run both Thorney and Augustus

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/.

Test Fixtures

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.

Contributing

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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Ensure your changes are tested using Rspec
  6. Create a new Pull Request

License

Thorney is licensed under MIT.

About

A proposed back-end api for beta.parliament.uk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 98.4%
  • Other 1.6%