Module: GraphitiGql::SpecHelper
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/graphiti_gql/spec_helper.rb
Defined Under Namespace
Modules: ScopeTrackable
Instance Method Summary collapse
- #gid(*ids) ⇒ Object
- #gql_datetime(timestamp, precise = false) ⇒ Object
- #json ⇒ Object
- #proxy ⇒ Object
- #result ⇒ Object
- #run ⇒ Object
- #run! ⇒ Object
Instance Method Details
#gid(*ids) ⇒ Object
77 78 79 |
# File 'lib/graphiti_gql/spec_helper.rb', line 77 def gid(*ids) resource.gid(*ids) end |
#gql_datetime(timestamp, precise = false) ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/graphiti_gql/spec_helper.rb', line 62 def gql_datetime(, precise = false) if precise .utc.round(10).iso8601(6) else DateTime.parse(.to_s).iso8601 end end |
#json ⇒ Object
98 99 100 |
# File 'lib/graphiti_gql/spec_helper.rb', line 98 def json @json ||= result.response end |
#proxy ⇒ Object
70 71 72 73 74 75 |
# File 'lib/graphiti_gql/spec_helper.rb', line 70 def proxy q = defined?(query) ? query : nil with_pagination = respond_to?(:with_pagination) ? send(:with_pagination) : false opts = { with_pagination: with_pagination } resource.gql(params.merge(fields: fields), ctx, q, opts) end |
#result ⇒ Object
94 95 96 |
# File 'lib/graphiti_gql/spec_helper.rb', line 94 def result @result ||= run! end |
#run ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/graphiti_gql/spec_helper.rb', line 81 def run lambda do instance = proxy instance.run! instance end end |
#run! ⇒ Object
89 90 91 92 |
# File 'lib/graphiti_gql/spec_helper.rb', line 89 def run! @json = nil @result = run.call end |