diff --git a/Gemfile b/Gemfile index f3e606976..6ff4bf739 100644 --- a/Gemfile +++ b/Gemfile @@ -27,7 +27,7 @@ gem "foundation_rails_helper", "~> 4.0.1" gem "globalize", "~> 6.3.0" gem "globalize-accessors", "~> 0.3.0" gem "graphiql-rails", "~> 1.8.0" -gem "graphql", "~> 2.0.0" +gem "graphql", "~> 2.3.18" gem "groupdate", "~> 6.5.1" gem "image_processing", "~> 1.13.0" gem "invisible_captcha", "~> 2.3.0" diff --git a/Gemfile.lock b/Gemfile.lock index 2d2a4b344..88fcfb614 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -228,6 +228,7 @@ GEM faraday-net_http (3.3.0) net-http ffi (1.17.0) + fiber-storage (1.0.0) file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) @@ -255,8 +256,9 @@ GEM graphiql-rails (1.8.0) railties sprockets-rails - graphql (2.0.31) + graphql (2.3.18) base64 + fiber-storage groupdate (6.5.1) activesupport (>= 7) gyoku (1.4.0) @@ -740,7 +742,7 @@ DEPENDENCIES globalize (~> 6.3.0) globalize-accessors (~> 0.3.0) graphiql-rails (~> 1.8.0) - graphql (~> 2.0.0) + graphql (~> 2.3.18) groupdate (~> 6.5.1) i18n-tasks (~> 0.9.37) image_processing (~> 1.13.0) diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb index a2765bd8a..c542593dc 100644 --- a/spec/controllers/graphql_controller_spec.rb +++ b/spec/controllers/graphql_controller_spec.rb @@ -2,12 +2,6 @@ require "rails_helper" # Useful resource: http://graphql.org/learn/serving-over-http/ -def parser_error_raised?(response) - data_is_empty = response.parsed_body["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) } @@ -23,7 +17,8 @@ describe GraphqlController, type: :request do get "/graphql", params: { query: "Malformed query string" } expect(response).to have_http_status(:ok) - expect(parser_error_raised?(response)).to be_truthy + expect(response.parsed_body["data"]).to be nil + expect(response.parsed_body["errors"]).to be_present end specify "without query string" do @@ -58,7 +53,8 @@ describe GraphqlController, type: :request do post "/graphql", params: { query: "Malformed query string" }.to_json, headers: json_headers expect(response).to have_http_status(:ok) - expect(parser_error_raised?(response)).to be_truthy + expect(response.parsed_body["data"]).to be nil + expect(response.parsed_body["errors"]).to be_present end it "without query string" do