Sha256: f9706c9ac1643a4599d6a2e73e08ad9a539edc16193fff0d37042f6a47fd1339

Contents?: true

Size: 674 Bytes

Versions: 11

Compression:

Stored size: 674 Bytes

Contents

require 'spec_helper'

describe GraphQL::Schema do
  let(:schema) { DummySchema }

  describe "#rescue_from" do
    let(:rescue_middleware) { schema.middleware.first }

    it "adds handlers to the rescue middleware" do
      assert_equal(1, rescue_middleware.rescue_table.length)
      # normally, you'd use a real class, not a symbol:
      schema.rescue_from(:error_class) { "my custom message" }
      assert_equal(2, rescue_middleware.rescue_table.length)
    end
  end

  describe "#subscription" do
    it "calls fields on the subscription type" do
      res = schema.execute("subscription { test }")
      assert_equal("Test", res["data"]["test"])
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
graphql-0.12.1 spec/graphql/schema_spec.rb
graphql-0.12.0 spec/graphql/schema_spec.rb
graphql-0.11.1 spec/graphql/schema_spec.rb
graphql-0.11.0 spec/graphql/schema_spec.rb
graphql-0.10.9 spec/graphql/schema_spec.rb
graphql-0.10.8 spec/graphql/schema_spec.rb
graphql-0.10.7 spec/graphql/schema_spec.rb
graphql-0.10.6 spec/graphql/schema_spec.rb
graphql-0.10.5 spec/graphql/schema_spec.rb
graphql-0.10.4 spec/graphql/schema_spec.rb
graphql-0.10.3 spec/graphql/schema_spec.rb