Top Level Namespace
Defined Under Namespace
Modules: TestFrameworkHooks Classes: BugError, ClientErrorDetail, ClientErrorResponse, Hash, Hyperion, HyperionError, HyperionResult, HyperionUri, Multipart, PayloadDescriptor, ResponseDescriptor, RestRoute
Instance Method Summary collapse
-
#fake_route(route, return_value = nil) {|Hyperion::FakeServer::Request| ... } ⇒ Object
A simple wrapper around Hyperion::fake for the typical use case of one faked route.
- #hyperion_raise(msg) ⇒ Object
Instance Method Details
#fake_route(route, return_value = nil) {|Hyperion::FakeServer::Request| ... } ⇒ Object
A simple wrapper around Hyperion::fake for the typical use case of one faked route. The return value can either be specified as an argument or as a function of the request (using the block).
The structure of a rack response is specified at rack.github.io Hyperion loosens these requirements a little. For instance, the headers hash may be nil, and the body does not need to be wrapped in an array. See kim_spec.rb for details. The massaging is done in FakeServer#massage_response.
16 17 18 19 20 21 22 23 24 |
# File 'lib/hyperion_test/spec_helper.rb', line 16 def fake_route(route, return_value=nil, &block) if return_value && block fail 'cannot provide both a return_value and block' end block = block || proc{return_value} Hyperion.fake(route.uri.base) do |svr| svr.allow(route, &block) end end |
#hyperion_raise(msg) ⇒ Object
4 5 6 |
# File 'lib/hyperion/types/hyperion_error.rb', line 4 def hyperion_raise(msg) raise HyperionError, msg end |