Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test reset code for GraphQL-Ruby 2.1.3 #691

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@

after do
# Reset various instance variables to clear state between tests
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_tracers, [])
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_plugins, SomeOtherGraphQLAppSchema.plugins[0..1])
[GraphQL::Schema, SomeOtherGraphQLAppSchema, SomeGraphQLAppSchema].each(&:_reset_tracer_for_testing)
end

it 'traces the provided schemas' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@

after do
# Reset various instance variables to clear state between tests
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_tracers, [])
SomeOtherGraphQLAppSchema.instance_variable_set(:@own_plugins, SomeOtherGraphQLAppSchema.plugins[0..1])
[GraphQL::Schema, SomeOtherGraphQLAppSchema, SomeGraphQLAppSchema].each(&:_reset_tracer_for_testing)
end

it 'traces the provided schemas' do
SomeOtherGraphQLAppSchema.execute('query SimpleQuery{ __typename }')

_(spans.size).must_equal(8)
end

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/graphql/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module SchemaTestPatches
# Reseting @graphql_definition is needed for tests running against version `1.9.x`
# Other variables are used by ~> 2.0.19
def _reset_tracer_for_testing
%w[own_tracers trace_modes trace_class tracers graphql_definition].each do |ivar|
%w[own_tracers trace_modes trace_class tracers graphql_definition own_trace_modes].each do |ivar|
remove_instance_variable("@#{ivar}") if instance_variable_defined?("@#{ivar}")
end
end
Expand Down
Loading