Skip to content

For Contributors

hindman edited this page Oct 15, 2012 · 15 revisions

For Contributors to the Hydra-Head Gem

Testing the Gem

For the Impatient

  1. Clone the Hydra-Head code (to a fresh working copy)
    git clone [email protected]:projecthydra/hydra-head.git
  2. Switch to the hydra-head directory
    cd hydra-head
  3. Install bundler gem
    gem install bundler
  4. Get the project dependencies
    bundle install
  5. Grab the jetty submodule
    git submodule init; git submodule update
  6. Run the tests
    rake ci

    This rake task:
    1. creates the test app in tmp/test_app
    2. spins up jetty (in jettywrapper)
    3. imports fixtures
    4. runs rspec & cucumber tests
    5. kills jetty (in jettywrapper)

More Detailed Instructions & Notes

Hydra-Jetty

In order to test the gem during development, the hydra-jetty is included as a submodule to provide both a fedora and solr instance. Once you have cloned the github repository, run the following commands to load hydra-jetty:

git submodule init
git submodule update

To start jetty:

rake jetty:start

Note: the first time you start hydra-jetty, you must use the following command in order to properly configure jetty:

rake hydra:jetty:load

Testing the gem

The gem must be tested within the context of a Rails 3 application.

A rake task is provided for setting up a rails 3 test app in the tmp/test_app directory. To generate the app, run:

rake hyhead:setup_test_app

The specs, features and fixtures for testing the Hydra-Head gem are all contained within the test_support directory of the gem. Once you have installed the test app and have Hydra-Jetty running, you will be able to run the specs/features from within that app via the provided rake tasks.

To run both the specs and cucumber features (from within the test application):

rake hyhead:test

In order to run a single spec or cucumber feature, use the following from the command line:

export RAILS_ROOT="tmp/test_app"
rspec test_support/spec/controllers/catalog_controller_spec.rb  # path to the spec file you wish to run
cucumber test_support/features/mods_asset_show.feature          # path to the feature file you wish to run

Especially for Hydra-Head Gem Developers

Note about vendor/cache directory

In order to more quickly install the required gems, the gems have been cached and are stored in the vendor/cache directory. This was done to reduce the time bundler took to install all the gems and their dependencies. To get all the requisite gems, simply run:

bundle install --local

The cached gems also provide a quick means for generating a gemset for the test_app.

When developing the hydra-head gem, be sure to commit any changes to the vendor/cache directory when you update or install a new gem.

Note about Solr and Fedora config files

When you change the Solr and Fedora config files, you must update them in the generator templates directory (lib/generators/hydra-head) as well as root of the hydra_head code.

Clone this wiki locally