Module: Fake
- Defined in:
- lib/fake/fake.rb,
lib/fake/path.rb,
lib/fake/server.rb,
lib/fake/request.rb,
lib/fake/service.rb,
lib/fake_service.rb,
lib/fake/requests.rb,
lib/fake/response.rb,
lib/fake/request_handler.rb
Defined Under Namespace
Classes: InfiniteQueue, Path, RackApp, Request, RequestHandler, RequestHandlerBuilder, Requests, Response, Server, Service
Class Method Summary
collapse
Class Method Details
.clear ⇒ Object
15
16
17
|
# File 'lib/fake/fake.rb', line 15
def clear
@fake_service.clear
end
|
.method_missing(method, *args, &block) ⇒ Object
20
21
22
23
24
25
26
27
28
|
# 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") ⇒ Object
3
4
5
6
|
# 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 ⇒ Object
8
9
10
11
12
13
|
# File 'lib/fake/fake.rb', line 8
def stop
sleep 0.5
@fake_service.stop
end
|