@@ -39,9 +39,9 @@ def initialize(type_name:, field_name:)
3939 end
4040 end
4141
42- def run_graphql_field ( schema , field_path , object , arguments : { } , context : { } , ast_node : nil , lookahead : nil )
42+ def run_graphql_field ( schema , field_path , object , arguments : { } , context : { } , ast_node : nil , lookahead : nil , visibility_profile : nil )
4343 type_name , *field_names = field_path . split ( "." )
44- dummy_query = GraphQL ::Query . new ( schema , "{ __typename }" , context : context )
44+ dummy_query = GraphQL ::Query . new ( schema , "{ __typename }" , context : context , visibility_profile : visibility_profile )
4545 query_context = dummy_query . context
4646 dataloader = query_context . dataloader
4747 object_type = dummy_query . types . type ( type_name ) # rubocop:disable Development/ContextIsPassedCop
@@ -104,41 +104,44 @@ def run_graphql_field(schema, field_path, object, arguments: {}, context: {}, as
104104 end
105105 end
106106
107- def with_resolution_context ( schema , type :, object :, context :{ } )
107+ def with_resolution_context ( schema , type :, object :, context :{ } , visibility_profile : nil )
108108 resolution_context = ResolutionAssertionContext . new (
109109 self ,
110110 schema : schema ,
111111 type_name : type ,
112112 object : object ,
113- context : context
113+ context : context ,
114+ visibility_profile : visibility_profile ,
114115 )
115116 yield ( resolution_context )
116117 end
117118
118119 class ResolutionAssertionContext
119- def initialize ( test , type_name :, object :, schema :, context :)
120+ def initialize ( test , type_name :, object :, schema :, context :, visibility_profile : )
120121 @test = test
121122 @type_name = type_name
122123 @object = object
123124 @schema = schema
124125 @context = context
126+ @visibility_profile = visibility_profile
125127 end
126128
129+ attr_reader :visibility_profile
127130
128131 def run_graphql_field ( field_name , arguments : { } )
129132 if @schema
130- @test . run_graphql_field ( @schema , "#{ @type_name } .#{ field_name } " , @object , arguments : arguments , context : @context )
133+ @test . run_graphql_field ( @schema , "#{ @type_name } .#{ field_name } " , @object , arguments : arguments , context : @context , visibility_profile : @visibility_profile )
131134 else
132- @test . run_graphql_field ( "#{ @type_name } .#{ field_name } " , @object , arguments : arguments , context : @context )
135+ @test . run_graphql_field ( "#{ @type_name } .#{ field_name } " , @object , arguments : arguments , context : @context , visibility_profile : @visibility_profile )
133136 end
134137 end
135138 end
136139
137140 module SchemaHelpers
138141 include Helpers
139142
140- def run_graphql_field ( field_path , object , arguments : { } , context : { } )
141- super ( @@schema_class_for_helpers , field_path , object , arguments : arguments , context : context )
143+ def run_graphql_field ( field_path , object , arguments : { } , context : { } , visibility_profile : nil )
144+ super ( @@schema_class_for_helpers , field_path , object , arguments : arguments , context : context , visibility_profile : visibility_profile )
142145 end
143146
144147 def with_resolution_context ( *args , **kwargs , &block )
0 commit comments