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!
Written by Roger Leite
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#