@@ -23,6 +23,9 @@ class Subscription < GraphQL::Schema::Object
2323 field :some_field , String
2424 end
2525
26+ class CustomSubscriptions < GraphQL ::Subscriptions ::ActionCableSubscriptions
27+ end
28+
2629 let ( :base_schema ) do
2730 Class . new ( GraphQL ::Schema ) do
2831 query Query
@@ -47,6 +50,7 @@ class Subscription < GraphQL::Schema::Object
4750 multiplex_analyzer Object . new
4851 rescue_from ( StandardError ) { }
4952 use GraphQL ::Backtrace
53+ use GraphQL ::Subscriptions ::ActionCableSubscriptions , action_cable : nil , action_cable_coder : JSON
5054 end
5155 end
5256
@@ -73,11 +77,15 @@ class Subscription < GraphQL::Schema::Object
7377 assert_equal base_schema . query_analyzers , schema . query_analyzers
7478 assert_equal base_schema . multiplex_analyzers , schema . multiplex_analyzers
7579 assert_equal base_schema . disable_introspection_entry_points? , schema . disable_introspection_entry_points?
76- assert_equal [ GraphQL ::Backtrace ] , schema . plugins . map ( &:first )
80+ assert_equal [ GraphQL ::Backtrace , GraphQL ::Subscriptions ::ActionCableSubscriptions ] , schema . plugins . map ( &:first )
81+ assert_instance_of GraphQL ::Subscriptions ::ActionCableSubscriptions , schema . subscriptions
7782 end
7883
7984 it "can override configuration from its superclass" do
80- schema = Class . new ( base_schema )
85+ schema = Class . new ( base_schema ) do
86+ use CustomSubscriptions , action_cable : nil , action_cable_coder : JSON
87+ end
88+
8189 query = Class . new ( GraphQL ::Schema ::Object ) do
8290 graphql_name 'Query'
8391 field :some_field , String
@@ -141,9 +149,10 @@ class Subscription < GraphQL::Schema::Object
141149 assert_equal schema . directives , GraphQL ::Schema . default_directives . merge ( DummyFeature1 . graphql_name => DummyFeature1 , DummyFeature2 . graphql_name => DummyFeature2 )
142150 assert_equal base_schema . query_analyzers + [ query_analyzer ] , schema . query_analyzers
143151 assert_equal base_schema . multiplex_analyzers + [ multiplex_analyzer ] , schema . multiplex_analyzers
144- assert_equal [ GraphQL ::Backtrace ] , schema . plugins . map ( &:first )
152+ assert_equal [ GraphQL ::Backtrace , GraphQL :: Subscriptions :: ActionCableSubscriptions , CustomSubscriptions ] , schema . plugins . map ( &:first )
145153 assert_equal [ GraphQL ::Tracing ::DataDogTracing , GraphQL ::Backtrace ::Tracer ] , base_schema . tracers
146154 assert_equal [ GraphQL ::Tracing ::DataDogTracing , GraphQL ::Backtrace ::Tracer , GraphQL ::Tracing ::NewRelicTracing ] , schema . tracers
155+ assert_instance_of CustomSubscriptions , schema . subscriptions
147156 end
148157 end
149158
0 commit comments