Ruby Hooks Handler for Dredd API Testing Framework
DISCLAIMER: This is an early version of dred-hooks-ruby, please be aware that it will not be stable until v1.0.0. At any moment, feedback is welcome! : )
Add the gem to your
# Gemfile gem 'dredd_hooks', '0.1.2' # see semver.org
Create a hook file (the file name is arbitrary):
# ./hooks.rb require 'dredd_hooks/methods' include DreddHooks::Methods before "Machines > Machines collection > Get Machines" do |transaction| transaction['skip'] = "true" end
Run it with Dredd:
# note that the hooks file was named ./hooks.rb dredd apiary.apib localhost:3000 --language ruby --hookfiles ./hooks.rb
DreddHooks::Methods module provides the following methods to be used with transaction names:
And these ones to be used without them:
See also the official Hooks documentation.
# Run the test suite rake
RSpec tags are used to categorize the spec examples.
Spec examples that are tagged as
public describe aspects of the gem public API, and MAY be considered as its documentation.
protected specs are written for development purpose only. Because they describe internal behaviour which may change at any moment without notice, they are only executed as a secondary task by the continuous integration service and SHOULD be ignored.
rake spec:public to print the gem public documentation.
Extending the DSL to support new hooks is meant to be easy, see the maintenance documentation for details. : )
Refactored with love, internet style.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Update the
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request