Permalink
Browse files

Return a predictable error inside a resolve.

  • Loading branch information...
dblock committed Oct 30, 2017
1 parent bfa5d67 commit 027d75cf5ca5bebc2fdb1b1dcb329430e417049e
Showing with 32 additions and 5 deletions.
  1. +3 −3 .rubocop_todo.yml
  2. +2 −2 Gemfile.lock
  3. +6 −0 app/graphql/queries.rb
  4. +21 −0 spec/graphql/queries/execution_error_query_spec.rb
View
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-10-24 12:50:07 -0400 using RuboCop version 0.51.0.
# on 2017-10-30 13:50:00 -0400 using RuboCop version 0.51.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 15
# Offense count: 16
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
@@ -20,7 +20,7 @@ Style/Documentation:
- 'app/controllers/graphql_controller.rb'
- 'config/application.rb'
# Offense count: 2
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: line_count_dependent, lambda, literal
View
@@ -52,7 +52,7 @@ GEM
ffi (1.9.18)
globalid (0.4.0)
activesupport (>= 4.2.0)
graphlient (0.0.7)
graphlient (0.1.0)
faraday
faraday_middleware
graphql-client
@@ -153,7 +153,7 @@ GEM
sqlite3 (1.3.13)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.3)
tzinfo (1.2.4)
thread_safe (~> 0.1)
unicode-display_width (1.3.0)
websocket-driver (0.6.5)
View
@@ -11,4 +11,10 @@
)
}
end
field :executionError, InvoiceType do
resolve ->(_object, _inputs, _ctx) {
GraphQL::ExecutionError.new('This has not been implemented yet.')
}
end
end
@@ -0,0 +1,21 @@
require 'rails_helper'
describe 'Execution Error Query', type: :request do
include_context 'GraphQL Client'
let(:query) do
<<-GRAPHQL
query {
executionError {
id
}
}
GRAPHQL
end
it 'raises an execution error' do
expect do
client.execute(query)
end.to raise_error Graphlient::Errors::ExecutionError, 'executionError: This has not been implemented yet.'
end
end

0 comments on commit 027d75c

Please sign in to comment.