Module: Mimic
- Defined in:
- lib/mimic.rb,
lib/mimic/api.rb,
lib/mimic/stub.rb,
lib/mimic/server.rb,
lib/mimic/fake_host.rb,
lib/mimic/api_request.rb,
lib/mimic/stubbed_request.rb
Defined Under Namespace
Classes: API, APIRequest, FakeHost, Server, Stub, StubbedRequest
Constant Summary
collapse
- MIMIC_DEFAULT_PORT =
11988
- MIMIC_DEFAULT_OPTIONS =
{
:hostname => 'localhost',
:port => MIMIC_DEFAULT_PORT,
:remote_configuration_path => nil,
:fork => true,
:log => nil
}
Class Method Summary
collapse
Class Method Details
.cleanup! ⇒ Object
27
28
29
|
# File 'lib/mimic.rb', line 27
def self.cleanup!
Mimic::Server.instance.shutdown
end
|
.mimic(options = {}, &block) ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/mimic.rb', line 17
def self.mimic(options = {}, &block)
options = MIMIC_DEFAULT_OPTIONS.merge(options)
host = FakeHost.new(options)
host.instance_eval(&block) if block_given?
Server.instance.serve(host, options)
add_host(host)
end
|
.reset_all! ⇒ Object
31
32
33
|
# File 'lib/mimic.rb', line 31
def self.reset_all!
@hosts.each { |h| h.clear }
end
|