-
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:- on Linux/macOS you can use
rbenv
withruby-build
; - on Windows you can use RubyInstaller.
- on Linux/macOS you can use
-
Install Mozilla Geckodriver via some means (e.g. Brew or any Linux package manager), in order to run feature tests which use Selenium.
-
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
-
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
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.
-
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 runningrake erd
. -
Running
rspec
and then checkingcoverage/index.html
can help you ensure you have full test coverage of your changes.
-
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
-
Visit
$dashboard_url/admin
- where$dashboard_url
is the URL you are accessing the GOTV dashboard at, e.g.http://localhost:3000
by default. -
Enter username as
admin
, password as the value exported above.