mercredi 24 février 2016

Unit testing a sinatra application which only process external api requests

I have a requirement, where I would have to implement Unit testing on a Sinatra application using RSpec and FactoryGirl which only processes external API request to a server.

The sinatra application will be receiving HTTP requests like GET, PUT, POST and Delete from a Ruby on Rails application. And in Sinatra we have routes to do a specific functionality.

Components involved are:

VServer: A ruby class file which is used to find the hostname from Ldap and establish connection to the server.

I have routes for various operations like Creating a volume, Deleting a volume, Resizing a volume. Whenever a route is called, it in turn calls a method in Ruby gem and the ruby gem will make the call to the server to fulfill that request.

Now I am looking to find a way to test this functionality.

I am kind of stuck on this. Help me much appreciated.

Thanks, Mahesh

Aucun commentaire:

Enregistrer un commentaire