Module: Spoofer
- Defined in:
- lib/spoofer.rb,
lib/spoofer/api.rb,
lib/spoofer/version.rb,
lib/spoofer/api/stub.rb,
lib/spoofer/fake_host.rb,
lib/spoofer/api/api_request.rb,
lib/spoofer/fake_host/helpers.rb,
lib/spoofer/fake_host/request_echo.rb,
lib/spoofer/fake_host/stubbed_request.rb
Defined Under Namespace
Classes: API, FakeHost, Server
Constant Summary
collapse
- SPOOFER_DEFAULT_PORT =
11988
- SPOOFER_DEFAULT_OPTIONS =
{
hostname: 'localhost',
port: SPOOFER_DEFAULT_PORT,
remote_configuration_path: nil,
fork: true,
log: nil
}
- VERSION =
'0.1.0'
Class Method Summary
collapse
Class Method Details
.cleanup! ⇒ Object
34
35
36
|
# File 'lib/spoofer.rb', line 34
def self.cleanup!
Spoofer::Server.instance.shutdown
end
|
.poser(options = {}, &block) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/spoofer.rb', line 24
def self.poser(options = {}, &block)
options = SPOOFER_DEFAULT_OPTIONS.merge(options)
host = FakeHost.new(options).tap do |h|
h.instance_eval(&block) if block_given?
Server.instance.serve(h, options)
end
add_host(host)
end
|
.reset_all! ⇒ Object
38
39
40
|
# File 'lib/spoofer.rb', line 38
def self.reset_all!
@hosts.each { |h| h.clear }
end
|