Sha256: bbe14c10248b1c5435722ed37baa7d9b35c9caf947ad99f86a0f9c8804e19069

Contents?: true

Size: 862 Bytes

Versions: 12

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Schema::CatchallMiddleware do
  let(:result) { Dummy::Schema.execute(query_string) }
  let(:query_string) {%| query noMilk { error }|}

  before do
    Dummy::Schema.middleware << GraphQL::Schema::CatchallMiddleware
  end

  after do
    Dummy::Schema.middleware.delete(GraphQL::Schema::CatchallMiddleware)
  end

  if TESTING_RESCUE_FROM
    describe "rescuing errors" do
      let(:errors) { query.context.errors }

      it "turns into error messages" do
        expected = {
          "data" => { "error" => nil },
          "errors"=> [
            {
              "message"=>"Internal error",
              "locations"=>[{"line"=>1, "column"=>17}],
              "path"=>["error"]
            },
          ]
        }
        assert_equal(expected, result)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
graphql-1.9.7 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.6 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.5 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.4 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.3 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.2 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.1 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.0 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.0.pre4 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.0.pre3 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.0.pre2 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.9.0.pre1 spec/graphql/schema/catchall_middleware_spec.rb