Update GraphQL and GraphiQL gem
This commit is contained in:
4
Gemfile
4
Gemfile
@@ -67,7 +67,7 @@ gem 'redcarpet', '~> 3.4.0'
|
||||
|
||||
gem 'paperclip'
|
||||
|
||||
gem 'graphql', '~> 1.3.0'
|
||||
gem 'graphql', '~> 1.5.12'
|
||||
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
@@ -104,7 +104,7 @@ end
|
||||
group :development do
|
||||
# Access an IRB console on exception pages or by using <%= console %> in views
|
||||
gem 'web-console', '3.3.0'
|
||||
gem 'graphiql-rails'
|
||||
gem 'graphiql-rails', '~> 1.4.1'
|
||||
end
|
||||
|
||||
eval_gemfile './Gemfile_custom'
|
||||
|
||||
@@ -174,9 +174,9 @@ GEM
|
||||
geocoder (1.4.3)
|
||||
globalid (0.3.7)
|
||||
activesupport (>= 4.1.0)
|
||||
graphiql-rails (1.3.0)
|
||||
graphiql-rails (1.4.1)
|
||||
rails
|
||||
graphql (1.3.0)
|
||||
graphql (1.5.12)
|
||||
groupdate (3.2.0)
|
||||
gyoku (1.3.1)
|
||||
builder (>= 2.1.2)
|
||||
@@ -499,8 +499,8 @@ DEPENDENCIES
|
||||
foundation-rails (~> 6.2.4.0)
|
||||
foundation_rails_helper (~> 2.0.0)
|
||||
fuubar
|
||||
graphiql-rails
|
||||
graphql (~> 1.3.0)
|
||||
graphiql-rails (~> 1.4.1)
|
||||
graphql (~> 1.5.12)
|
||||
groupdate (~> 3.2.0)
|
||||
i18n-tasks (~> 0.9.15)
|
||||
initialjs-rails (= 0.2.0.4)
|
||||
|
||||
@@ -2,6 +2,12 @@ require 'rails_helper'
|
||||
|
||||
# Useful resource: http://graphql.org/learn/serving-over-http/
|
||||
|
||||
def parser_error_raised?(response)
|
||||
data_is_empty = response['data'].nil?
|
||||
error_is_present = (JSON.parse(response.body)['errors'].first['message'] =~ /^Parse error on/)
|
||||
data_is_empty && error_is_present
|
||||
end
|
||||
|
||||
describe GraphqlController, type: :request do
|
||||
let(:proposal) { create(:proposal) }
|
||||
|
||||
@@ -16,8 +22,8 @@ describe GraphqlController, type: :request do
|
||||
specify "with malformed query string" do
|
||||
get '/graphql', query: 'Malformed query string'
|
||||
|
||||
expect(response).to have_http_status(:bad_request)
|
||||
expect(JSON.parse(response.body)['message']).to eq('Query string is not valid JSON')
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(parser_error_raised?(response)).to be_truthy
|
||||
end
|
||||
|
||||
specify "without query string" do
|
||||
@@ -49,8 +55,8 @@ describe GraphqlController, type: :request do
|
||||
specify "with malformed query string" do
|
||||
post '/graphql', { query: "Malformed query string" }.to_json, json_headers
|
||||
|
||||
expect(response).to have_http_status(:bad_request)
|
||||
expect(JSON.parse(response.body)['message']).to eq('Query string is not valid JSON')
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(parser_error_raised?(response)).to be_truthy
|
||||
end
|
||||
|
||||
it "without query string" do
|
||||
|
||||
Reference in New Issue
Block a user