Skip to content

Instantly share code, notes, and snippets.

@chrishunt
Last active December 16, 2015 00:28
Show Gist options
  • Save chrishunt/5347443 to your computer and use it in GitHub Desktop.
Save chrishunt/5347443 to your computer and use it in GitHub Desktop.
Fake service for testing

Fake Service

Don't want to start all your services? No problem! Make fake ones.

Start all services in your Procfile with:

$ bundle exec foreman start
require 'sinatra'
require 'json'
module MyService
class FakeServer < Sinatra::Base
get '/' do
{
success: true,
message: 'Hello World'
}.to_json
end
end
end
source 'https://rubygems.org'
gem 'foreman'
gem 'sinatra'
require './fake_server'
run Rack::URLMap.new \
"/" => MyService::FakeServer
# Add all your services here!
# Start 'MyService' fake service on port 3001
my_service: rackup --port 3001 my_service_config.ru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment