Skip to content

For Contributors

Max Kadel edited this page Mar 15, 2021 · 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 git@github.com:samvera/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. Run the tests
    bundle exec rake ci

    This rake task:
    1. creates the test app in .internal_test_app
    2. spins up solr (in solr_wrapper)
    3. spins up fedora (in fcrepo_wrapper)
    4. imports fixtures
    5. runs rspec
    6. kills solr & fedora

More Detailed Testing Instructions & Notes

Development gem dependencies

Sometimes the versions of gems needed for development outpace the gems needed for the gemspec itself. It is valuable to keep the requirements for the gem itself as broad as possible, to allow for broad adoption, but gems we use exclusively for development and testing may require a higher version of a gem, particularly rails. To test the gem using a higher version of rails you can set the environment variable RAILS_VERSION and then bundle install. E.g. RAILS_ENV=">= 5.2.4" bundle install

Sometimes in the course of generating the internal_test_app the Gemfile.lock of the gem itself and the internal_test_app’s Gemfile.lock can get out of sync. If that happens, you can run

bundle update [angry_gem]

If you are testing and decide to use different versions of Ruby or particular gems, you can delete both Gemfile.lock files and re-bundle using
bundle install

Running single tests

In order to run a single spec, in one terminal window start the test server using

bundle exec rake test_server

then in another window use the following from the command line:

bundle exec rake spec SPEC=spec/controllers/catalog_controller_spec.rb  # path to the spec file you wish to run

When running individual tests, you may get success on one gem and failure on the other gem – this is expected, since some tests exist only in a single gem.

Clone this wiki locally