Sha256: 54fcfaa2eb227b1e5ecb1b38e652fb9a98fa29e2f2286b97d8f5bbda714dd328

Contents?: true

Size: 764 Bytes

Versions: 14

Compression:

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

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
graphql-1.2.6 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.2.5 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.2.4 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.2.3 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.2.2 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.2.1 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.2.0 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.1.0 spec/graphql/schema/catchall_middleware_spec.rb
graphql-1.0.0 spec/graphql/schema/catchall_middleware_spec.rb
graphql-0.19.4 spec/graphql/schema/catchall_middleware_spec.rb
graphql-0.19.3 spec/graphql/schema/catchall_middleware_spec.rb
graphql-0.19.2 spec/graphql/schema/catchall_middleware_spec.rb
graphql-0.19.1 spec/graphql/schema/catchall_middleware_spec.rb
graphql-0.19.0 spec/graphql/schema/catchall_middleware_spec.rb