- Ruby (v2.0+)
- Bundler
- Rack (web server middleware)
- Sinatra (web server framework)
If you have Bundler (the Ruby gem for installing Ruby gem libraries via a Gemfile):
bundle install
Otherwise install the following libraries:
gem install rack
gem install sinatra
- If you have permissions issues installing then a quick fix is to run the commands as root user e.g.
sudo gem install rack
andsudo gem install sinatra
Open a terminal and start the web server:
cd sinatra-mock-server-template/
rake
You should see an output similar to this:
The server is now bound to your local IP address, making also possible to point devices to it.
- Edit the
App.rb
and add new endpoints matching the URLs you want to mock - Add sample json responses in the
responses
folder
You can updated the responses and endpoints target this local server in automated tests for your mobile applications. 🎉
Visit http://YOUR_IP:9292/repos/contributors/
to see sample mock JSON response.