Class: ShopifyAPI::Mock::Response
- Inherits:
-
Object
- Object
- ShopifyAPI::Mock::Response
- Defined in:
- lib/shopify-mock/response.rb
Overview
used to manage the mocked responses
Constant Summary collapse
- @@responses =
store for all registered responses
[]
Class Method Summary collapse
-
.all ⇒ Array, FakeWeb
finds all the registered responses.
-
.clear ⇒ Array
clears all the currently registered responses.
Instance Method Summary collapse
-
#initialize(method, resource, response) ⇒ FakeWeb
constructor
creates and registers a new mocked response.
Constructor Details
#initialize(method, resource, response) ⇒ FakeWeb
creates and registers a new mocked response
13 14 15 16 17 18 |
# File 'lib/shopify-mock/response.rb', line 13 def initialize(method, resource, response) @@responses += FakeWeb.register_uri( method, /#{SHOPIFY_MOCK_SHOP_BASE_URL}#{resource}/, :body => response ) end |
Class Method Details
.all ⇒ Array, FakeWeb
finds all the registered responses
29 30 31 |
# File 'lib/shopify-mock/response.rb', line 29 def all @@responses end |
.clear ⇒ Array
clears all the currently registered responses
38 39 40 41 |
# File 'lib/shopify-mock/response.rb', line 38 def clear FakeWeb.clean_registry @@responses = [] end |