A sample project that shows you how to test a ruby webapp that uses Elasticsearch.
What does it include
- A simple webapp built with Sinatra that exposes two APIs:
GET /searchandPOST /index GET /search?q=foowill search your Elasticsearch instance for the stringfooPOST /indexwill add the JSON body of the request to your Elasticsearch instance
How to run this project on Shippable
- Fork it
- Enable it
- Run it
The project comes with a working shippable.yml file.
How to run this locally
-
Get an Elasticsearch server running locally. If you have Docker, this is all you need to do:
docker run -d -p 9200 -p 9300 elasticsearch -
Clone this repository and
bundle installthe first time to get all the gems. Then run the Sinatra webapp with this command:ELASTIC_SEARCH_PORT=9200 ELASTIC_SEARCH_HOST=localhost ruby app.rb -
Run the tests with
bundle exec rake test