Sha256: 87b8a98bd4aa568ddd0766b58f35f5f9f0f6e2a6b799b3b5a709d7f904f52dad

Contents?: true

Size: 776 Bytes

Versions: 13

Compression:

Stored size: 776 Bytes

Contents

require "spec_helper"

describe GraphQL::StaticValidation::SubscriptionRootExists do
  include StaticValidationHelpers

  let(:query_string) {%|
    subscription {
      test
    }
  |}

  let(:schema) {
    query_root = GraphQL::ObjectType.define do
      name "Query"
      description "Query root of the system"
    end

    GraphQL::Schema.define do
      query query_root
    end
  }

  it "errors when a subscription is performed on a schema without a subscription root" do
    assert_equal(1, errors.length)
    missing_subscription_root_error = {
      "message"=>"Schema is not configured for subscriptions",
      "locations"=>[{"line"=>2, "column"=>5}],
      "fields"=>["subscription"],
    }
    assert_includes(errors, missing_subscription_root_error)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
graphql-1.2.6 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.2.5 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.2.4 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.2.3 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.2.2 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.2.1 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.2.0 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.1.0 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.0.0 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-0.19.4 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-0.19.3 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-0.19.2 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-0.19.1 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb