- Clone the repo and cd into it
- Install rbenv or rvm
- Install ruby 2.2.2
rbenv install 2.2.2 - Install bundler
gem install bundler - On OSX
brew install libxml2 libxslt libiconv - ON OSX
gem install nokogiri -v '1.6.7.2' -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 --use-system-libraries - Install your gems
bundle - Install zeus
gem install zeus - Install postgres (I'll leave this as an exercise for the reader)
- Create an .envrc file for loading private configuration information
cp .envrc.example .envrc - Create your database
rake db:create - Perform your migrations
rake db:migrate - Seed your data
rake db:seed - Prepare your test db
rake db:test:prepare
After installation:
zeus start
From another terminal, run zeus server to start a test server or run
zeus test to run tests.
- Fork it and create a branch from
master - Test the code you contribute.
- Wrap your delegate test cases in
VCR.use_cassette...to avoid spamming delegates every time you run the test. - Make a github issue if you have questions or encounter bugs
- Make a pull request when your contribution is ready
Messages are sent to delegates via webforms. To add a new delegate,
find their contact page, then implement a class with two public
methods: def initialize(message) and def deliver!. message will
be an instance of Message Your class
should throw an error if it fails to send the message, and return nil
if it succeeds.
All classes for contacting reps must use the def agent method provided by
including include Delegates::Agent in your class (unless the page
requires JavaScript in which case see below). agent returns a
Mechanize instance that
can be used to drive interaction with the page. See the
Delegates::WA::Murray
class as an example and the
Mechanize docs
for more information.
Reps almost all use basically the same website with a multi-step form
requiring zip code confirmation before the user can submit the
actual message. For these your class should inherit from
Delegates::RepBase
and override protected methods as needed — usually just def form_url,
def rep_name, and def set_form_fields.
Some delegates have contact forms that are handled using JavaScript.
For these your class should inherit from
Delegates::JSBase,
which provides a Capybara
session running in Phantomjs
accessible via the def session method. See the
Delegates::WA::Cantwell
class for an example.
Do not use the JSBase class unless the site you are dealing with
necessitates it.
VCR cannot intercept HTTP requests from Phantomjs, so your test will
make an actual form submission to the delegate every time it runs
(assuming it works properly). For this reason, include the
:live_test tag in the describe block of your test for the class, so
that it won't run on CI and normal test suite runs. See the
cantwell_spec.rb
for an example.
- Andrew Jacobson @andyjac
- Bion Johnson @bion
- David Balatero @dbalatero
- Heather Moore @heatherm
- Heather Perry @southernzen
- Jacob Reynolds @jereynolds
- Philip Bjorge @philipbjorge