Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

bobwhitelock/gotv-dashboard

Repository files navigation

Contributor Covenant

GOTV Dashboard

Guides

Setup for local development

  1. Install the Ruby version specified in .ruby-version by some method for your operating system - if you do not have an existing preferred method for doing this:

  2. Install Mozilla Geckodriver via some means (e.g. Brew or any Linux package manager), in order to run feature tests which use Selenium.

  3. Clone and set up the repo:

    git clone [email protected]:bobwhitelock/gotv-dashboard.git
    cd gotv-dashboard
    gem install bundler
    gem update --system
    bundle install --without production
    rake db:setup
    rails server
  4. To create a work space for development, either:

    a. visit http://localhost:3000 and click the link to generate a demo work space;

    b. or, if you have access to Contact Creator and some real data, and want to try using this, export this data and run:

    rake gotv:import_contact_creator \
       name=$name_for_your_work_space \
       polling_stations=$url_for_polling_stations_data \
       campaign_stats=$url_for_campaign_stats_data

To run tests

The dashboard has fairly complete test coverage, and this should ideally be maintained as new features are added. Most of the test coverage is via Capybara feature tests, and so will require Mozilla Geckodriver to run as described above.

To run tests, use rspec.

Once all tests have been run, coverage/index.html can be viewed in a browser to see all test coverage.

Development tips

  • The app mostly follows standard Rails conventions, so getting familiar with these will help.

  • An ERD diagram of all app models is available at docs/erd.pdf. This should be automatically regenerated as the database is migrated, but you can ensure it's up-to-date by running rake erd.

  • Running rspec and then checking coverage/index.html can help you ensure you have full test coverage of your changes.

To access admin dashboard

  1. Have GOTV_DASHBOARD_PASSWORD environment variable exported in your environment before running the app, e.g. like this:

    export GOTV_DASHBOARD_PASSWORD='verysecure123'
    bin/rails server
  2. Visit $dashboard_url/admin - where $dashboard_url is the URL you are accessing the GOTV dashboard at, e.g. http://localhost:3000 by default.

  3. Enter username as admin, password as the value exported above.