Sha256: 64a85a950659d5f9af6ff7470c122137cf5b48d6098d31b8ad43fce1d5e5347e

Contents?: true

Size: 1.39 KB

Versions: 23

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Tracing::ActiveSupportNotificationsTracing do
  let(:schema) {
    StarWars::Schema.redefine {
      tracer GraphQL::Tracing::ActiveSupportNotificationsTracing
    }
  }

  it "pushes through AS::N" do
    traces = []

    callback = ->(name, started, finished, id, data) {
      traces << name
    }

    query_string = <<-GRAPHQL
    query Bases($id1: ID!, $id2: ID!){
      b1: batchedBase(id: $id1) { name }
      b2: batchedBase(id: $id2) { name }
    }
    GRAPHQL
    first_id = StarWars::Base.first.id
    last_id = StarWars::Base.last.id

    ActiveSupport::Notifications.subscribed(callback, /^graphql/) do
      schema.execute(query_string, variables: {
        "id1" => first_id,
        "id2" => last_id,
      })
    end

    expected_traces = [
      "graphql.lex",
      "graphql.parse",
      "graphql.validate",
      "graphql.analyze_query",
      "graphql.analyze_multiplex",
      "graphql.execute_field",
      "graphql.execute_field",
      "graphql.execute_query",
      "graphql.lazy_loader",
      "graphql.execute_field_lazy",
      "graphql.execute_field",
      "graphql.execute_field_lazy",
      "graphql.execute_field",
      "graphql.execute_field_lazy",
      "graphql.execute_field_lazy",
      "graphql.execute_query_lazy",
      "graphql.execute_multiplex",
    ]
    assert_equal expected_traces, traces
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
graphql-1.8.18 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.17 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.16 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.15 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.14 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.13 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.12 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.11 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.10 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.9 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.8 spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.7 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.6 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.5 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.4 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.3 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.2 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.1 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.0 spec/graphql/tracing/active_support_notifications_tracing_spec.rb
graphql-1.8.0.pre11 spec/graphql/tracing/active_support_notifications_tracing_spec.rb