repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/datadog.rb | spec/support/datadog.rb | # frozen_string_literal: true
# A stub for the Datadog agent, so we can make assertions about how it is used
if defined?(Datadog)
raise "Expected Datadog to be undefined, so that we could define a stub for it."
end
module Datadog
SPAN_RESOURCE_NAMES = []
SPAN_TAGS = []
TRACE_KEYS = []
def self.tracer
Du... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/minimum_input_object.rb | spec/support/minimum_input_object.rb | # frozen_string_literal: true
# This is the minimum required interface for an input object
class MinimumInputObject
include Enumerable
def initialize(values)
@values = values
end
def each(&block)
@values.each(&block)
end
def [](key)
@values[key]
end
def key?(key)
@values.key?(key)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/lazy_helpers.rb | spec/support/lazy_helpers.rb | # frozen_string_literal: true
module LazyHelpers
MAGIC_NUMBER_WITH_LAZY_AUTHORIZED_HOOK = 44
MAGIC_NUMBER_THAT_RETURNS_NIL = 0
MAGIC_NUMBER_THAT_RAISES_ERROR = 13
class Wrapper
def initialize(item = nil, &block)
if block
@block = block
else
@item = item
end
end
def... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/new_relic.rb | spec/support/new_relic.rb | # frozen_string_literal: true
# A stub for the NewRelic agent, so we can make assertions about how it is used
if defined?(NewRelic)
raise "Expected NewRelic to be undefined, so that we could define a stub for it."
end
module NewRelic
TRANSACTION_NAMES = []
EXECUTION_SCOPES = []
# Reset state between tests
de... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/static_validation_helpers.rb | spec/support/static_validation_helpers.rb | # frozen_string_literal: true
# This module assumes you have `let(:query_string)` in your spec.
# It provides `errors` which are the validation errors for that string,
# as validated against `Dummy::Schema`.
# You can override `schema` to provide another schema
# @example testing static validation
# include StaticVal... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/jazz.rb | spec/support/jazz.rb | # frozen_string_literal: true
# Here's the "application"
module Jazz
module Models
Instrument = Struct.new(:name, :family)
Ensemble = Struct.new(:name)
Musician = Struct.new(:name, :favorite_key)
Key = Struct.new(:root, :sharp, :flat) do
def self.from_notation(key_str)
key, sharp_or_fla... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/rubocop_test_helpers.rb | spec/support/rubocop_test_helpers.rb | # frozen_string_literal: true
require "yaml"
module RubocopTestHelpers
def run_rubocop_on(fixture_path, autocorrect: false)
assert_cop_runs_on(fixture_path)
result = `bundle exec rubocop --debug #{autocorrect ? "--auto-correct" : ""} --config spec/fixtures/cop/.rubocop.yml #{fixture_path} 2>&1`
refute_in... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/perfetto_snapshot.rb | spec/support/perfetto_snapshot.rb | # frozen_string_literal: true
module PerfettoSnapshot
def check_snapshot(data, snapshot_name)
prev_file = caller(1, 1).first.sub(/\/[a-z_]*\.rb:.*/, "")
snapshot_dir = prev_file + "/snapshots"
snapshot_path = "#{snapshot_dir}/#{snapshot_name}"
iid_table = { "debugAnnotationNames" => {}, "eventNames" ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/appoptics.rb | spec/support/appoptics.rb | # frozen_string_literal: true
# A stub for the AppOpticsAPM agent, so we can make assertions about how it is used
if defined?(AppOpticsAPM) && !AppOpticsAPM.graphql_test
raise "Expected AppOpticsAPM to be undefined, so that we can define a stub for it."
end
module AppOpticsAPM
def self.loaded; true; end
module ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/mongoid_setup.rb | spec/support/mongoid_setup.rb | # frozen_string_literal: true
if testing_mongoid?
# TODO make this work with existing fixtures
Mongoid.load_configuration({
clients: {
default: {
database: 'graphql_ruby_test',
hosts: ['localhost:27017']
}
},
sessions: {
default: {
database: 'graphql_ruby_test'... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/scout_apm.rb | spec/support/scout_apm.rb | # frozen_string_literal: true
# A stub for the Scout agent, so we can make assertions about how it is used
if defined?(ScoutApm)
raise "Expected ScoutApm to be undefined, so that we could define a stub for it."
end
class ScoutApm
TRANSACTION_NAMES = []
EVENTS = []
def self.clear_all
TRANSACTION_NAMES.clea... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/sentry.rb | spec/support/sentry.rb | # frozen_string_literal: true
# A stub for the Sentry agent, so we can make assertions about how it is used
if defined?(Sentry)
raise "Expected Sentry to be undefined, so that we could define a stub for it."
end
module Sentry
SPAN_OPS = []
SPAN_DATA = []
SPAN_DESCRIPTIONS = []
TRANSACTION_NAMES = []
clas... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/dummy_scheduler.rb | spec/support/dummy_scheduler.rb | # frozen_string_literal: true
# From the Ruby source (https://github.com/ruby/ruby/blob/master/test/fiber/scheduler.rb)
#
# This is an example and simplified scheduler for test purposes.
# It is not efficient for a large number of file descriptors as it uses IO.select().
# Production Fiber schedulers should use epoll/k... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/active_record_setup.rb | spec/support/active_record_setup.rb | # frozen_string_literal: true
if testing_rails?
# Remove the old sqlite database
sqlite_path = File.expand_path(File.join(__FILE__, "../../../_test_.db"))
puts "Removing #{sqlite_path}"
`rm -f #{sqlite_path}`
if ActiveRecord.respond_to?(:async_query_executor=) # Rails 7.1+
ActiveRecord.async_query_execut... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/dummy/data.rb | spec/support/dummy/data.rb | # frozen_string_literal: true
require 'ostruct'
module Dummy
module Data
Cheese = Struct.new(:id, :flavor, :origin, :fat_content, :source) do
def ==(other)
# This is buggy on purpose -- it shouldn't be called during execution.
other.id == id
end
# Alias for when this is treated ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/dummy/schema.rb | spec/support/dummy/schema.rb | # frozen_string_literal: true
require "graphql"
require_relative "./data"
module Dummy
class NoSuchDairyError < StandardError; end
class BaseField < GraphQL::Schema::Field
end
class AdminField < GraphQL::Schema::Field
def visible?(context)
context[:admin] == true
end
end
module BaseInterfac... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/support/star_wars/schema.rb | spec/support/star_wars/schema.rb | # frozen_string_literal: true
module StarWars
# Adapted from graphql-relay-js
# https://github.com/graphql/graphql-relay-js/blob/master/src/__tests__/starWarsSchema.js
class Ship < GraphQL::Schema::Object
implements GraphQL::Types::Relay::Node
global_id_field :id
field :name, String
# Test cyclic... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/data.rb | spec/integration/rails/data.rb | # frozen_string_literal: true
require 'ostruct'
require "support/active_record_setup"
module StarWars
names = [
'X-Wing',
'Y-Wing',
'A-Wing',
'Millennium Falcon',
'Home One',
'TIE Fighter',
'TIE Interceptor',
'Executor',
]
class StarWarsModel < ActiveRecord::Base
self.abstrac... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/query_logs_spec.rb | spec/integration/rails/query_logs_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "Integration with ActiveRecord::QueryLogs" do
class QueryLogSchema < GraphQL::Schema
class Thing < ActiveRecord::Base
belongs_to :other_thing, class_name: "Thing"
end
class ThingSource < GraphQL::Dataloader::Source
def fetch(ids)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/spec_helper.rb | spec/integration/rails/spec_helper.rb | # frozen_string_literal: true
require "rake"
require "rails/all"
require "rails/generators"
require "sequel"
if ENV['DATABASE'] == 'POSTGRESQL'
require 'pg'
else
require "sqlite3"
end
if ENV["ISOLATION_LEVEL_FIBER"]
ActiveSupport::IsolatedExecutionState.isolation_level = :fiber
puts "ActiveSupport::IsolatedEx... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/dataloader_spec.rb | spec/integration/rails/graphql/dataloader_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Dataloader do
if defined?(ActiveRecord::Promise) && ENV['DATABASE'] == 'POSTGRESQL' # Rails 7.1+
class RailsPromiseSchema < GraphQL::Schema
class LoadAsyncSource < GraphQL::Dataloader::Source
LOG = []
def fetch(relations)... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/schema_spec.rb | spec/integration/rails/graphql/schema_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema do
let(:schema) { Dummy::Schema }
let(:admin_schema) { Dummy::AdminSchema }
let(:relay_schema) { StarWars::Schema }
let(:empty_schema) { Class.new(GraphQL::Schema) }
describe "#find" do
it "finds a member using a string path" ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/input_object_spec.rb | spec/integration/rails/graphql/input_object_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::InputObject do
let(:input_object) do
Dummy::DairyProductInput.new(
nil,
ruby_kwargs: { source: 'COW', fatContent: 0.8 },
defaults_used: Set.new,
context: GraphQL::Query::NullContext.instance)
end
describe ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/query/variables_spec.rb | spec/integration/rails/graphql/query/variables_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::Variables do
let(:query_string) {%|
query getCheese(
$animals: [DairyAnimal!],
$intDefaultNull: Int = null,
$int: Int,
$intWithDefault: Int = 10)
{
cheese(id: 1) {
similarCheese(source: $animals)
}
}
|}... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/relay/connection_type_spec.rb | spec/integration/rails/graphql/relay/connection_type_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Relay::ConnectionType" do
describe ".create_type" do
describe "connections with custom Edge classes / EdgeTypes" do
let(:query_string) {%|
query($testNames: Boolean!) {
rebels {
basesWithCustomEdge {
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/relay/page_info_spec.rb | spec/integration/rails/graphql/relay/page_info_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Relay::PageInfo" do
def get_page_info(result)
result["data"]["empire"]["bases"]["pageInfo"]
end
def get_first_cursor(result)
result["data"]["empire"]["bases"]["edges"].first["cursor"]
end
def get_last_cursor(result)
result["... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/relay/connection_resolve_spec.rb | spec/integration/rails/graphql/relay/connection_resolve_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Relay::ConnectionResolve" do
let(:query_string) { <<-GRAPHQL
query getShips($name: String!, $testParentName: Boolean = false){
rebels {
ships(nameIncludes: $name) {
edges {
node {
name
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/relay/array_connection_spec.rb | spec/integration/rails/graphql/relay/array_connection_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "GraphQL::Relay::ArrayConnection" do
def get_names(result)
ships = result["data"]["rebels"]["ships"]["edges"]
ships.map { |e| e["node"]["name"] }
end
def get_last_cursor(result)
result["data"]["rebels"]["ships"]["edges"].last["cursor"]
e... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/relay/range_add_spec.rb | spec/integration/rails/graphql/relay/range_add_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Relay::RangeAdd do
# Make sure that the encoder is found through `ctx.schema`:
module PassThroughEncoder
def self.encode(unencoded_text, nonce: false)
"__#{unencoded_text}"
end
def self.decode(encoded_text, nonce: false)
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/relay/relation_connection_spec.rb | spec/integration/rails/graphql/relay/relation_connection_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "GraphQL::Relay::RelationConnection" do
def get_names(result)
ships = result["data"]["empire"]["bases"]["edges"]
ships.map { |e| e["node"]["name"] }
end
def get_page_info(result)
result["data"]["empire"]["bases"]["pageInfo"]
end
def g... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb | spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Tracing::ActiveSupportNotificationsTracing do
let(:schema) {
Class.new(StarWars::Schema) do
tracer GraphQL::Tracing::ActiveSupportNotificationsTracing
end
}
it "pushes through AS::N" do
traces = []
callback = ->(name, s... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/types/iso_8601_duration_spec.rb | spec/integration/rails/graphql/types/iso_8601_duration_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::ISO8601Duration do
module DurationTest
class Schema < GraphQL::Schema
def self.type_error(err, ctx)
raise err
end
end
end
let(:context) { GraphQL::Query.new(DurationTest::Schema, "{ __typename }").context }
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/graphql/dataloader/async_dataloader_spec.rb | spec/integration/rails/graphql/dataloader/async_dataloader_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Dataloader::AsyncDataloader do
class RailsAsyncSchema < GraphQL::Schema
class CustomAsyncDataloader < GraphQL::Dataloader::AsyncDataloader
def cleanup_fiber
end
def get_fiber_variables
vars = super
vars[:conn... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/base_generator_test.rb | spec/integration/rails/generators/base_generator_test.rb | # frozen_string_literal: true
class BaseGeneratorTest < Rails::Generators::TestCase
destination File.expand_path("../../tmp", File.dirname(__FILE__))
setup :prepare_destination
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/relay_generator_spec.rb | spec/integration/rails/generators/graphql/relay_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/relay_generator"
require "generators/graphql/install_generator"
class GraphQLGeneratorsRelayGeneratorTest < Rails::Generators::TestCase
tests Graphql::Generators::RelayGenerator
destination File.expand_path("../../../tmp/dummy", File.d... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/scalar_generator_spec.rb | spec/integration/rails/generators/graphql/scalar_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/scalar_generator"
class GraphQLGeneratorsScalarGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::ScalarGenerator
test "it generates scalar class" do
expected_content = <<-RUBY
# frozen_string_literal: true
module Types... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/mutation_delete_generator_spec.rb | spec/integration/rails/generators/graphql/mutation_delete_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/mutation_delete_generator"
class GraphQLGeneratorsMutationDeleteGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::MutationDeleteGenerator
destination File.expand_path("../../../tmp/dummy", File.dirname(__FILE__))
setup :... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/object_generator_spec.rb | spec/integration/rails/generators/graphql/object_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/object_generator"
class GraphQLGeneratorsObjectGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::ObjectGenerator
# rubocop:disable Style/ClassAndModuleChildren
class ::TestUser < ActiveRecord::Base
end
# rubocop:enabl... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/union_generator_spec.rb | spec/integration/rails/generators/graphql/union_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/union_generator"
class GraphQLGeneratorsUnionGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::UnionGenerator
test "it generates a union with possible types" do
commands = [
# GraphQL-style:
["WingedCreature... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/interface_generator_spec.rb | spec/integration/rails/generators/graphql/interface_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/interface_generator"
class GraphQLGeneratorsInterfaceGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::InterfaceGenerator
test "it generates fields with types" do
commands = [
# GraphQL-style:
["Bird", "wing... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/mutation_create_generator_spec.rb | spec/integration/rails/generators/graphql/mutation_create_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/mutation_create_generator"
class GraphQLGeneratorsMutationCreateGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::MutationCreateGenerator
destination File.expand_path("../../../tmp/dummy", File.dirname(__FILE__))
setup :... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/input_generator_spec.rb | spec/integration/rails/generators/graphql/input_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/input_generator"
class GraphQLGeneratorsInputGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::InputGenerator
# rubocop:disable Style/ClassAndModuleChildren
class ::InputTestUser < ActiveRecord::Base
end
# rubocop:ena... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/loader_generator_spec.rb | spec/integration/rails/generators/graphql/loader_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/loader_generator"
class GraphQLGeneratorsLoaderGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::LoaderGenerator
test "it generates an empty loader by name" do
run_generator(["RecordLoader"])
expected_content = <<-... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/mutation_update_generator_spec.rb | spec/integration/rails/generators/graphql/mutation_update_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/mutation_update_generator"
class GraphQLGeneratorsMutationUpdateGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::MutationUpdateGenerator
destination File.expand_path("../../../tmp/dummy", File.dirname(__FILE__))
setup :... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/mutation_generator_spec.rb | spec/integration/rails/generators/graphql/mutation_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/mutation_generator"
require "generators/graphql/install_generator"
class GraphQLGeneratorsMutationGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::MutationGenerator
setup :prepare_destination
UPDATE_NAME_MUTATION = <<-R... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/install_generator_spec.rb | spec/integration/rails/generators/graphql/install_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/install_generator"
class GraphQLGeneratorsInstallGeneratorTest < Rails::Generators::TestCase
tests Graphql::Generators::InstallGenerator
destination File.expand_path("../../../tmp/dummy", File.dirname(__FILE__))
setup do
prepare... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/rails/generators/graphql/enum_generator_spec.rb | spec/integration/rails/generators/graphql/enum_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/enum_generator"
class GraphQLGeneratorsEnumGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::EnumGenerator
test "it generate enums with values" do
expected_content = <<-RUBY
# frozen_string_literal: true
module Types
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/mongoid/graphql/relay/mongo_relation_connection_spec.rb | spec/integration/mongoid/graphql/relay/mongo_relation_connection_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "GraphQL::Relay::MongoRelationConnection" do
def get_names(result)
ships = result["data"]["federation"]["bases"]["edges"]
ships.map { |e| e["node"]["name"] }
end
def get_residents(ship)
ship["residents"]["edges"].map { |e| e["node"]["name"... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/mongoid/star_trek/data.rb | spec/integration/mongoid/star_trek/data.rb | # frozen_string_literal: true
require 'ostruct'
require 'support/mongoid_setup'
module StarTrek
names = [
'USS Enterprise',
'USS Excelsior',
'USS Reliant',
'IKS Koraga',
'IKS Kronos One',
'IRW Khazara',
'IRW Praetus',
]
# Set up "Bases" in MongoDB
class Base
include Mongoid::Do... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/integration/mongoid/star_trek/schema.rb | spec/integration/mongoid/star_trek/schema.rb | # frozen_string_literal: true
module StarTrek
# Adapted from graphql-relay-js
# https://github.com/graphql/graphql-relay-js/blob/master/src/__tests__/StarTrekSchema.js
class Ship < GraphQL::Schema::Object
implements GraphQL::Types::Relay::Node
global_id_field :id
field :name, String
# Test cyclic... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/lazy_module/lazy_class.rb | spec/fixtures/lazy_module/lazy_class.rb | # frozen_string_literal: true
module LazyModule
module LazyClass
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/root_types.rb | spec/fixtures/cop/root_types.rb | class MyAppSchema < GraphQL::Schema
query Types::Query
mutation Types::Mutation
subscription Types::Subscription
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/field_type.rb | spec/fixtures/cop/field_type.rb | class Types::Query
field :current_account, Types::Account, null: false, description: "The account of the current viewer"
field :find_account, Types::Account do
argument :id, ID
end
# Don't modify these:
field :current_time, String, description: "The current time in the viewer's timezone"
field :curren... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/root_types_corrected.rb | spec/fixtures/cop/root_types_corrected.rb | class MyAppSchema < GraphQL::Schema
query { Types::Query }
mutation { Types::Mutation }
subscription { Types::Subscription }
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/null_true.rb | spec/fixtures/cop/null_true.rb | class Types::Something < Types::BaseObject
field :name, String, null: true
field :other_name, String,
null: true,
description: "Here's a description"
field :described, [String, null: true], null: true, description: "Something"
field :ok_field, String
field :also_ok_field, String, null: false
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/required_true.rb | spec/fixtures/cop/required_true.rb | class Types::Something < Types::BaseObject
field :name, String do
argument :id_1, ID, required: true
argument :id_2,
ID,
required: true,
description: "Described"
argument :id_3, ID, other_config: { something: false, required: true }, required: true, description: "Something"
argume... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/small_field_type.rb | spec/fixtures/cop/small_field_type.rb | class Types::Admin::FooType < Types::FooType
field :bar, Types::BarType
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/null_true_corrected.rb | spec/fixtures/cop/null_true_corrected.rb | class Types::Something < Types::BaseObject
field :name, String
field :other_name, String,
description: "Here's a description"
field :described, [String, null: true], description: "Something"
field :ok_field, String
field :also_ok_field, String, null: false
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/field_type_array_corrected.rb | spec/fixtures/cop/field_type_array_corrected.rb | class Types::FooType < Types::BaseObject
field :other, [String]
field :bar, null: false do
type [Thing]
argument :baz, String
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/field_type_interface.rb | spec/fixtures/cop/field_type_interface.rb | module Types::FooType
include Types::BaseInterface
field :thing, Thing
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/field_type_interface_corrected.rb | spec/fixtures/cop/field_type_interface_corrected.rb | module Types::FooType
include Types::BaseInterface
field :thing do
type Thing
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/field_type_corrected.rb | spec/fixtures/cop/field_type_corrected.rb | class Types::Query
field :current_account, null: false, description: "The account of the current viewer" do
type Types::Account
end
field :find_account do
type Types::Account
argument :id, ID
end
# Don't modify these:
field :current_time, String, description: "The current time in the viewer's ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/required_true_corrected.rb | spec/fixtures/cop/required_true_corrected.rb | class Types::Something < Types::BaseObject
field :name, String do
argument :id_1, ID
argument :id_2,
ID,
description: "Described"
argument :id_3, ID, other_config: { something: false, required: true }, description: "Something"
argument :id_4, ID, required: false
argument :id_5, ID
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/cop/field_type_array.rb | spec/fixtures/cop/field_type_array.rb | class Types::FooType < Types::BaseObject
field :other, [String]
field :bar, [Thing], null: false do
argument :baz, String
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/eager_module/eager_class.rb | spec/fixtures/eager_module/eager_class.rb | # frozen_string_literal: true
module EagerModule
module EagerClass
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/eager_module/nested_eager_module.rb | spec/fixtures/eager_module/nested_eager_module.rb | # frozen_string_literal: true
module EagerModule
module NestedEagerModule
extend GraphQL::Autoload
autoload(:NestedEagerClass, "fixtures/eager_module/nested_eager_module/nested_eager_class")
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/eager_module/other_eager_class.rb | spec/fixtures/eager_module/other_eager_class.rb | # frozen_string_literal: true
module EagerModule
module OtherEagerClass
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/fixtures/eager_module/nested_eager_module/nested_eager_class.rb | spec/fixtures/eager_module/nested_eager_module/nested_eager_class.rb | # frozen_string_literal: true
module EagerModule
module NestedEagerModule
class NestedEagerClass
end
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/non_null_type_spec.rb | spec/graphql/non_null_type_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::NonNullType" do
describe "when a non-null field returns null" do
it "nulls out the parent selection" do
query_string = %|{ cow { name cantBeNullButIs } }|
result = Dummy::Schema.execute(query_string)
assert_equal({"cow" => n... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/dataloader_spec.rb | spec/graphql/dataloader_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "fiber"
if defined?(Console) && defined?(Async)
Console.logger.disable(Async::Task)
end
describe GraphQL::Dataloader do
class BatchedCallsCounter
def initialize
@count = 0
end
def increment
@count += 1
end
attr_reader :c... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/subscriptions_spec.rb | spec/graphql/subscriptions_spec.rb | # frozen_string_literal: true
require "spec_helper"
class InMemoryBackend
MAX_COMPLEXITY = 5
class Subscriptions < GraphQL::Subscriptions
attr_reader :deliveries, :pushes, :extra, :queries, :events
def initialize(schema:, extra:, **rest)
super
@extra = extra
@queries = {}
# { topic... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query_spec.rb | spec/graphql/query_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query do
let(:query_string) { %|
query getFlavor($cheeseId: Int!) {
brie: cheese(id: 1) { ...cheeseFields, taste: flavor },
cheese(id: $cheeseId) {
__typename,
id,
...cheeseFields,
... edibleField... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/authorization_spec.rb | spec/graphql/authorization_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Authorization" do
module AuthTest
class Box
attr_reader :value
def initialize(value:)
@value = value
end
end
class BaseArgument < GraphQL::Schema::Argument
def visible?(context)
super && (conte... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/directive_spec.rb | spec/graphql/directive_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Directive" do
let(:variables) { {"t" => true, "f" => false} }
let(:result) { Dummy::Schema.execute(query_string, variables: variables) }
describe "on fields" do
let(:query_string) { %|query directives($t: Boolean!, $f: Boolean!) {
c... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/analysis_spec.rb | spec/graphql/analysis_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Analysis do
class AstTypeCollector < GraphQL::Analysis::Analyzer
def initialize(query)
super
@types = []
end
def on_enter_operation_definition(node, parent, visitor)
@types << visitor.type_definition
end
def... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/tracing_spec.rb | spec/graphql/tracing_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Tracing do
class DummyTraceable
def initialize(*tracers)
@tracers = tracers
end
include GraphQL::Tracing::Traceable
end
describe "#trace" do
it "delivers the metadata to send_trace, with result and key" do
returne... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/backtrace_spec.rb | spec/graphql/backtrace_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Backtrace do
class LazyError
def raise_err
raise "Lazy Boom"
end
end
class ErrorAnalyzer < GraphQL::Analysis::Analyzer
def on_enter_operation_definition(node, parent_node, visitor)
if node.name == "raiseError"
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema_spec.rb | spec/graphql/schema_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema do
describe "inheritance" do
class DummyFeature1 < GraphQL::Schema::Directive::Feature
end
class DummyFeature2 < GraphQL::Schema::Directive::Feature
end
class Query < GraphQL::Schema::Object
field :some_field, ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/autoload_spec.rb | spec/graphql/autoload_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "open3"
describe GraphQL::Autoload do
module LazyModule
extend GraphQL::Autoload
autoload(:LazyClass, "fixtures/lazy_module/lazy_class")
end
module EagerModule
extend GraphQL::Autoload
autoload(:EagerClass, "fixtures/eager_module/eager... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/invalid_null_error_spec.rb | spec/graphql/invalid_null_error_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::InvalidNullError" do
it "can be inspected" do
assert_equal "GraphQL::InvalidNullError", GraphQL::InvalidNullError.inspect
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/current_spec.rb | spec/graphql/current_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Current do
describe "when no query is running" do
it "returns nil for things" do
assert_nil GraphQL::Current.operation_name
assert_nil GraphQL::Current.field
assert_nil GraphQL::Current.dataloader_source_class
end
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/logger_spec.rb | spec/graphql/logger_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "Logger" do
describe "Schema.default_logger" do
if defined?(Rails)
it "When Rails is present, returns the Rails logger" do
prev_logger = Rails.logger # might be `nil`
Rails.logger = Object.new
assert_equal Rails.logger, Gr... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/rake_task_spec.rb | spec/graphql/rake_task_spec.rb | # frozen_string_literal: true
require "spec_helper"
rake_task_schema_defn = <<-GRAPHQL
type Query {
allowed(allowed: ID!, excluded: ID!): Int
excluded(excluded: ID!): Boolean
ignored(input: NotOneOf): Float
}
input NotOneOf {
arg: Int,
}
GRAPHQL
RakeTaskSchema = GraphQL::Schema.from_definition(rake_task_sche... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/execution_error_spec.rb | spec/graphql/execution_error_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::ExecutionError do
let(:result) { Dummy::Schema.execute(query_string) }
describe "when returned from a field" do
let(:query_string) {%|
{
cheese(id: 1) {
id
error1: similarCheese(source: [YAK]) {
... similarCheeseFie... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/result_spec.rb | spec/graphql/query/result_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::Result do
let(:query_string) { '{ __type(name: "Cheese") { name } }' }
let(:schema) { Dummy::Schema }
let(:result) { schema.execute(query_string, context: { a: :b }) }
it "exposes hash-like methods" do
assert_equal "Cheese", resu... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/context_spec.rb | spec/graphql/query/context_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::Context do
after do
# Clean up test fixtures so they don't pollute later tests
# (Usually this is cleaned up by execution code, but many tests here don't actually execute queries)
Fiber[:__graphql_runtime_info] = nil
end
cl... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/variable_validation_error_spec.rb | spec/graphql/query/variable_validation_error_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::VariableValidationError do
let(:ast) { Struct.new(:name, :line, :col).new('input', 1, 2) }
let(:type) { Struct.new(:to_type_signature).new('TestType') }
let(:error_value) { 'some value' }
let(:problems) { [{'path' => ['path-to-problem... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/variables_spec.rb | spec/graphql/query/variables_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Query::Variables" do
module VariablesTest
class MaxValidationSchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
field :items, [String], null: false do
argument :a, Int
argument :b, Int
a... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/null_context_spec.rb | spec/graphql/query/null_context_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::NullContext do
let(:null_context) { GraphQL::Query::NullContext.instance }
describe "#[]" do
it "returns nil" do
assert_nil(null_context[:foo])
end
end
describe "#fetch" do
it "returns the default value argument" do... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/executor_spec.rb | spec/graphql/query/executor_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Query::Executor" do
let(:operation_name) { nil }
let(:schema) { Dummy::Schema }
let(:variables) { {"cheeseId" => 2} }
let(:query) { GraphQL::Query.new(
schema,
query_string,
variables: variables,
operation_name: operation_na... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/fingerprint_spec.rb | spec/graphql/query/fingerprint_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::Fingerprint do
def build_query(str, var)
GraphQL::Query.new(Dummy::Schema, str, variables: var)
end
it "makes stable variable fingerprints" do
var1a = { "a" => 1, "b" => 2 }
var1b = { "a" => 1, "b" => 2 }
# These keys a... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/partial_spec.rb | spec/graphql/query/partial_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::Partial do
class PartialSchema < GraphQL::Schema
module Database
FARMS = {
"1" => OpenStruct.new(name: "Bellair Farm", products: ["VEGETABLES", "MEAT", "EGGS"], neighboring_farm_id: "2"),
"2" => OpenStruct.new(name... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/query/context/scoped_context_spec.rb | spec/graphql/query/context/scoped_context_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::Context::ScopedContext do
class ScopedContextSchema < GraphQL::Schema
class Promise
def initialize(parent = nil, &block)
@parent = parent
@block = block
@value = nil
@children = []
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/subscriptions/broadcast_analyzer_spec.rb | spec/graphql/subscriptions/broadcast_analyzer_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Subscriptions::BroadcastAnalyzer do
class BroadcastTestSchema < GraphQL::Schema
LOG_OUTPUT = StringIO.new
LOGGER = Logger.new(LOG_OUTPUT)
LOGGER.formatter = ->(severity, time, progname, msg) { "#{severity}: #{msg}\n"}
module Throwa... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/subscriptions/serialize_spec.rb | spec/graphql/subscriptions/serialize_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Subscriptions::Serialize do
def serialize_dump(v)
GraphQL::Subscriptions::Serialize.dump(v)
end
def serialize_load(v)
GraphQL::Subscriptions::Serialize.load(v)
end
if defined?(GlobalID)
it "should serialize GlobalID::Identifi... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/subscriptions/action_cable_subscriptions_spec.rb | spec/graphql/subscriptions/action_cable_subscriptions_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Subscriptions::ActionCableSubscriptions" do
class ActionCableTestSchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
field :int, Integer
end
class Filter < GraphQL::Schema::InputObject
argument :trending , Bool... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/subscriptions/event_spec.rb | spec/graphql/subscriptions/event_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Subscriptions::Event do
class EventSchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
end
class JsonSubscription < GraphQL::Schema::Subscription
argument :some_json, GraphQL::Types::JSON, required: false
fiel... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/introspection/type_type_spec.rb | spec/graphql/introspection/type_type_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Introspection::TypeType do
let(:query_string) {%|
query introspectionQuery {
cheeseType: __type(name: "Cheese") { name, kind, fields { name, isDeprecated, type { kind, name, ofType { name } } } }
milkType: __type(name: "... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/introspection/introspection_query_spec.rb | spec/graphql/introspection/introspection_query_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "GraphQL::Introspection::INTROSPECTION_QUERY" do
let(:schema) {
Class.new(Dummy::Schema) do
max_depth(15)
end
}
let(:query_string) { GraphQL::Introspection::INTROSPECTION_QUERY }
let(:result) { schema.execute(query_string) }
it "run... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/introspection/directive_type_spec.rb | spec/graphql/introspection/directive_type_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Introspection::DirectiveType do
let(:query_string) {%|
query getDirectives {
__schema {
directives {
name,
args { name, type { kind, name, ofType { name } } },
locations
isRepeatable
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.