Module: EphemeralResponse
- Defined in:
- lib/ephemeral_response.rb,
lib/ephemeral_response/fixture.rb,
lib/ephemeral_response/request.rb,
lib/ephemeral_response/null_output.rb,
lib/ephemeral_response/configuration.rb
Defined Under Namespace
Modules: Configuration
Classes: Fixture, NullOutput, Request
Constant Summary
collapse
- VERSION =
"0.4.0".freeze
- Error =
Class.new(StandardError)
Class Method Summary
collapse
Class Method Details
.activate ⇒ Object
17
18
19
20
21
|
# File 'lib/ephemeral_response.rb', line 17
def self.activate
deactivate
load 'ephemeral_response/net_http.rb'
Fixture.load_all
end
|
.deactivate ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/ephemeral_response.rb', line 37
def self.deactivate
Net::HTTP.class_eval do
remove_method(:generate_uri) if method_defined?(:generate_uri)
remove_method(:uri) if method_defined?(:uri)
alias_method(:connect, :connect_without_ephemeral_response) if private_method_defined?(:connect_without_ephemeral_response)
alias_method(:request, :request_without_ephemeral_response) if method_defined?(:request_without_ephemeral_response)
end
Net::HTTPResponse.class_eval do
alias_method(:procdest, :procdest_without_ephemeral_response) if private_method_defined?(:procdest_without_ephemeral_response)
alias_method(:read_body, :read_body_without_ephemeral_response) if method_defined?(:read_body_without_ephemeral_response)
end
end
|
.fixture_set=(name) ⇒ Object
.fixtures ⇒ Object
50
51
52
|
# File 'lib/ephemeral_response.rb', line 50
def self.fixtures
Fixture.fixtures
end
|
.live ⇒ Object
FIXME: Don’t deactivate and reactivate, instead set a flag which ignores fixtures entirely.
56
57
58
59
60
|
# File 'lib/ephemeral_response.rb', line 56
def self.live
deactivate
yield
activate
end
|