module Fake
Public Class Methods
clear()
click to toggle source
# File lib/fake/fake.rb, line 15 def clear @fake_service.clear end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/fake/fake.rb, line 20 def self.method_missing(method, *args, &block) if [:post, :get].include?(method) request_handler = RequestHandler.new(method, *args) @fake_service.add_request_handler(request_handler) RequestHandlerBuilder.new(request_handler) else super end end
start(port:8080, bind:"localhost")
click to toggle source
# File lib/fake/fake.rb, line 3 def start(port:8080, bind:"localhost") @fake_service = Service.new(port:port, bind:bind) @fake_service.start end
stop()
click to toggle source
# File lib/fake/fake.rb, line 8 def stop # todo: something better, stop fails if start and stop comes almost the same # needs some check that if thread is alive and if not then yield (or something...) sleep 0.5 @fake_service.stop end