Last Updated: February 25, 2016
·
1.453K
· rogerleite

A real server to mock servers!

MinionServer is a ruby gem to help you with integration tests. You can create an app using Rack Builder and start a tiny server very easy. Let me show you some code:

require 'minion_server'

# build your integration app
IntegrationApp = Rack::Builder.new do
  map "/" do
    run lambda { |env|
      [200, {"Content-Type" => "text/plain"}, ["Be happy!"]]
    }
  end
end

server = MinionServer.new(IntegrationApp)
server.start("localhost", 1620)  # default: localhost, 4000

# do your calls
system "curl http://localhost:1620" # => "Be happy!"

server.shutdown

You can see more examples at http_monkey's integration tests.
Hope that helps!