Sha256: 27490f76ad9bec54449d5d247dabe693437777e2c0c83305a0c84bb834942f84

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

require "spec_helper"

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

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

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

  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"=>["noMilk", "error"]
          },
        ]
      }
      assert_equal(expected, result)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-0.18.15 spec/graphql/schema/catchall_middleware_spec.rb