Module: ActiveShopifyGraphQL::Testing
- Defined in:
- lib/active_shopify_graphql/testing.rb,
lib/active_shopify_graphql/testing/hook.rb,
lib/active_shopify_graphql/testing/store.rb,
lib/active_shopify_graphql/testing/test_loader.rb
Overview
Testing support module that provides an in-memory store for test data,
allowing developers to register records using Ruby-level attributes and
have find, where, includes, and connections work transparently without
real API calls.
Defined Under Namespace
Modules: AttributesHook, FinderMethodsHook, GraphqlTypeResolverHook, LoaderSwitchableHook
Classes: Store, TestLoader
Class Method Summary
collapse
Class Method Details
.enable! ⇒ Object
29
30
31
|
# File 'lib/active_shopify_graphql/testing.rb', line 29
def enable!
@enabled = true
end
|
.enabled? ⇒ Boolean
38
39
40
|
# File 'lib/active_shopify_graphql/testing.rb', line 38
def enabled?
@enabled == true
end
|
.register(model_class, records) ⇒ Object
Convenience delegate to store.register
47
48
49
|
# File 'lib/active_shopify_graphql/testing.rb', line 47
def register(model_class, records)
store.register(model_class, records)
end
|
.reset! ⇒ Object
33
34
35
36
|
# File 'lib/active_shopify_graphql/testing.rb', line 33
def reset!
@enabled = false
store.clear
end
|
.store ⇒ Object
42
43
44
|
# File 'lib/active_shopify_graphql/testing.rb', line 42
def store
@store ||= Store.new
end
|