h1. Directions to Clone and Test the Rails 3 hydra-head Code h2. For the Impatient # clone the hydra-head code (to a fresh working copy)
git clone git@github.com:projecthydra/hydra-head.git
# switch tot he hydra-head directory
cd hydra-head
# install bundler gem
gem install bundler
# Get the project dependencies
bundle install
# grab the jetty submodule
git submodule init; git submodule update
# test
rake hyhead:ci
This command: ## creates the test app in tmp/test_app ## spins up jetty (in jettywrapper) ## imports fixtures ## runs rspec & cucumber tests ## kills jetty (in jettywrapper) h2. More Detailed Instructions & Notes h3. The 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 the jetty:
git submodule init
git submodule update
To start the jetty:
rake jetty:start
Note: the first time you start the jetty, you must use the following command in order to properly configure the jetty:
rake hydra:jetty:load
h3. Testing the gem The specs and features for testing the gem within the context of a rails 3 app are all contained within the test_support directory. Once you have installed the test app, you will be able to run the specs/features from within that app via the provided rake tasks. 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
Once you have done this and have a jetty running, you are ready to run the specs and cucumbers:
rake hyhead:test
This will run the specs and cucumber features from within the test application. 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
h2. 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. Initially this was done to avoid the excessive amount of time bundler was taking 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 changes to the vendor/cache directory when you update or install a new gem. h2. 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.