Skip to content

Instantly share code, notes, and snippets.

@christemple
Last active August 29, 2015 14:25
Show Gist options
  • Save christemple/7541dfe54abfda95913e to your computer and use it in GitHub Desktop.
Save christemple/7541dfe54abfda95913e to your computer and use it in GitHub Desktop.
module Simulado
SIMULADO = Net::HTTP.new('localhost', 7001)
JSON_HEADERS = {'Content-Type' => 'application/json', 'Accept' => 'application/json'}
def mock(response)
SIMULADO.post('/syncMock', response.to_json, JSON_HEADERS)
end
def last_request(method, path)
headers = JSON_HEADERS.merge('method' => method, 'path' => path)
response = SIMULADO.get('/lastRequest', headers).body
JSON.parse(response)
end
end
World(Simulado)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment