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/graphql/language/document_from_schema_definition_spec.rb | spec/graphql/language/document_from_schema_definition_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Language::DocumentFromSchemaDefinition do
let(:subject) { GraphQL::Language::DocumentFromSchemaDefinition }
describe "#document" do
let(:schema_idl) { <<-GRAPHQL
type QueryType {
foo: Foo
u: Union
}
type F... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/sanitized_printer_spec.rb | spec/graphql/language/sanitized_printer_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Language::SanitizedPrinter do
module SanitizeTest
class Color < GraphQL::Schema::Enum
value "RED"
value "BLUE"
end
class Url < GraphQL::Schema::Scalar
end
class SimpleInput < GraphQL::Schema::InputObject
arg... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/nodes_spec.rb | spec/graphql/language/nodes_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Language::Nodes::AbstractNode do
describe ".visit_method" do
# `.visit_method` is really helpful for generating methods in
# custom visitor classes -- make sure this API keeps working.
it "names a method on the visitor class" do
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/generation_spec.rb | spec/graphql/language/generation_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Language::Generation do
describe "#to_query_tring" do
let(:document) {
GraphQL.parse('type Query { a: String! }')
}
let(:custom_printer_class) {
Class.new(GraphQL::Language::Printer) {
def print_field_definition(pr... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/printer_spec.rb | spec/graphql/language/printer_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Language::Printer do
let(:document) { GraphQL.parse(query_string) }
let(:query_string) {%|
query getStuff($someVar: Int = 1, $anotherVar: [String!] @special(very: true), $skipNested: Boolean! = false) @skip(if: false) {
myField: someFi... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/equality_spec.rb | spec/graphql/language/equality_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Language::Nodes::AbstractNode do
describe ".eql?" do
let(:document1) { GraphQL.parse(query_string1) }
let(:document2) { GraphQL.parse(query_string2) }
describe "large identical document" do
let(:query_string1) {%|
query ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/parser_spec.rb | spec/graphql/language/parser_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Language::Parser do
subject { GraphQL }
it "returns an error on bad UTF-8" do
err = assert_raises GraphQL::ParseError do
subject.parse("{ foo(query: \"\xBF\") }")
end
expected_message = if USING_C_PARSER
'Parse error on ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/clexer_spec.rb | spec/graphql/language/clexer_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./lexer_examples"
if defined?(GraphQL::CParser::Lexer)
describe GraphQL::CParser::Lexer do
subject { GraphQL::CParser::Lexer }
def assert_bad_unicode(string, _message = nil)
assert_equal :BAD_UNICODE_ESCAPE, subject.tokenize(string)... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/lexer_spec.rb | spec/graphql/language/lexer_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./lexer_examples"
describe GraphQL::Language::Lexer do
subject { GraphQL::Language::Lexer }
include LexerExamples
def assert_bad_unicode(string, expected_err_message = "Parse error on bad Unicode escape sequence")
err = assert_raises(Graph... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/language/lexer_examples.rb | spec/graphql/language/lexer_examples.rb | # frozen_string_literal: true
module TokenMethods
refine Array do
def name
self[0]
end
def value
self[3]
end
def to_s
self[3]
end
def line
self[1]
end
def col
self[2]
end
def inspect
"(#{name} #{value.inspect} [#{line}:#{col}])"
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/visibility_spec.rb | spec/graphql/schema/visibility_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Visibility do
class VisSchema < GraphQL::Schema
class BaseField < GraphQL::Schema::Field
def initialize(*args, admin_only: false, **kwargs, &block)
super(*args, **kwargs, &block)
@admin_only = admin_only
end... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/union_spec.rb | spec/graphql/schema/union_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Union do
let(:union) { Jazz::PerformingAct }
describe ".path" do
it "is the name" do
assert_equal "PerformingAct", union.path
end
end
describe "type info" do
it "has some" do
assert_equal 2, union.possible_t... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator_spec.rb | spec/graphql/schema/validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator/validator_helpers"
describe GraphQL::Schema::Validator do
include ValidatorHelpers
class CustomValidator < GraphQL::Schema::Validator
def initialize(equal_to:, **rest)
@equal_to = equal_to
super(**rest)
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/interface_spec.rb | spec/graphql/schema/interface_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Interface do
let(:interface) { Jazz::GloballyIdentifiableType }
describe ".path" do
it "is the name" do
assert_equal "GloballyIdentifiable", interface.path
end
end
describe "type info" do
it "tells its type info" ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/build_from_definition_spec.rb | spec/graphql/schema/build_from_definition_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::BuildFromDefinition do
# Build a schema from `definition` and assert that it
# prints out the same string.
# Then return the built schema.
def assert_schema_and_compare_output(definition)
built_schema = GraphQL::Schema.from_defin... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/relay_classic_mutation_spec.rb | spec/graphql/schema/relay_classic_mutation_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::RelayClassicMutation do
describe ".input_object_class" do
it "is inherited, with a default" do
custom_input = Class.new(GraphQL::Schema::InputObject)
mutation_base_class = Class.new(GraphQL::Schema::RelayClassicMutation) do... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/always_visible_spec.rb | spec/graphql/schema/always_visible_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::AlwaysVisible do
class AlwaysVisibleSchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
def self.visible?(ctx)
ctx[:visible_was_called] = true
false
end
field :one, Integer
def one; 1... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/non_null_spec.rb | spec/graphql/schema/non_null_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::NonNull do
let(:of_type) { Jazz::Musician }
let(:non_null_type) { GraphQL::Schema::NonNull.new(of_type) }
it "returns list? to be false" do
refute non_null_type.list?
end
it "returns non_null? to be true" do
assert non_n... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/introspection_system_spec.rb | spec/graphql/schema/introspection_system_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::IntrospectionSystem do
describe "custom introspection" do
it "serves custom fields on types" do
res = Jazz::Schema.execute("{ __schema { isJazzy } }")
assert_equal true, res["data"]["__schema"]["isJazzy"]
end
it "s... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/enum_spec.rb | spec/graphql/schema/enum_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Enum do
let(:enum) { Jazz::Family }
describe ".path" do
it "is the name" do
assert_equal "Family", enum.path
end
end
describe "value methods" do
class EnumWithValueMethods < GraphQL::Schema::Enum
value_metho... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/directive_spec.rb | spec/graphql/schema/directive_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Directive do
class MultiWord < GraphQL::Schema::Directive
end
it "uses a downcased class name" do
assert_equal "multiWord", MultiWord.graphql_name
end
module DirectiveTest
class Secret < GraphQL::Schema::Directive
a... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/scalar_spec.rb | spec/graphql/schema/scalar_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Scalar do
describe ".path" do
it "is the name" do
assert_equal "String", GraphQL::Types::String.path
end
end
describe "in queries" do
it "becomes output" do
query_str = <<-GRAPHQL
{
find(id: "Musi... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/field_spec.rb | spec/graphql/schema/field_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Field do
describe "graphql definition" do
let(:object_class) { Jazz::Query }
let(:field) { object_class.fields["inspectInput"] }
describe "path" do
it "is the object/interface and field name" do
assert_equal "Quer... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/loader_spec.rb | spec/graphql/schema/loader_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Loader do
Boolean = "Boolean"
ID = "ID"
Int = "Int"
let(:schema) {
node_type = Module.new do
include GraphQL::Schema::Interface
graphql_name "Node"
field :id, ID, null: false
end
choice_type = Class.n... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/instrumentation_spec.rb | spec/graphql/schema/instrumentation_spec.rb | # frozen_string_literal: true
require "spec_helper"
module InstrumentationSpec
module SomeInterface
include GraphQL::Schema::Interface
field :never_called, String, null: false
def never_called
"should never be called"
end
end
class SomeType < GraphQL::Schema::Object
implements SomeInt... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/base_64_encoder_spec.rb | spec/graphql/schema/base_64_encoder_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Base64Encoder do
describe ".decode" do
it "decodes base64 encoded strings" do
string = "12345"
encoded_string = GraphQL::Schema::Base64Encoder.encode(string)
decoded_string = GraphQL::Schema::Base64Encoder.decode(enco... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/unique_within_type_spec.rb | spec/graphql/schema/unique_within_type_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::UniqueWithinType do
describe 'encode / decode' do
it 'Converts typename and ID to and from ID' do
global_id = GraphQL::Schema::UniqueWithinType.encode("SomeType", 123)
type_name, id = GraphQL::Schema::UniqueWithinType.decod... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/mutation_spec.rb | spec/graphql/schema/mutation_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Mutation do
let(:mutation) { Jazz::AddInstrument }
after do
Jazz::Models.reset
end
it "Doesn't override !" do
assert_equal false, !mutation
end
describe "definition" do
it "passes along description" do
assert_... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/finder_spec.rb | spec/graphql/schema/finder_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Finder do
let(:finder) { GraphQL::Schema::Finder.new(Jazz::Schema) }
describe "#find" do
it "finds a valid object type" do
type = finder.find("Ensemble")
assert_equal "Ensemble", type.graphql_name
end
it "raises... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/subscription_spec.rb | spec/graphql/schema/subscription_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Subscription do
class SubscriptionFieldSchema < GraphQL::Schema
use GraphQL::Schema::Warden if ADD_WARDEN
TOOTS = []
ALL_USERS = {
"dhh" => {handle: "dhh", private: false},
"matz" => {handle: "matz", private: false}... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/input_object_spec.rb | spec/graphql/schema/input_object_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::InputObject do
let(:input_object) { Jazz::EnsembleInput }
describe ".path" do
it "is the name" do
assert_equal "EnsembleInput", input_object.path
end
it "is used in argument paths" do
assert_equal "EnsembleInput... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/object_spec.rb | spec/graphql/schema/object_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Object do
describe "class attributes" do
let(:object_class) { Jazz::Ensemble }
it "tells type data" do
assert_equal "Ensemble", object_class.graphql_name
assert_equal "A group of musicians playing together", object_clas... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/addition_spec.rb | spec/graphql/schema/addition_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Addition do
it "handles duplicate types with cycles" do
duplicate_types_schema = Class.new(GraphQL::Schema)
duplicate_types_schema.use_visibility_profile = false
duplicate_types = 2.times.map {
Class.new(GraphQL::Schema::... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/printer_spec.rb | spec/graphql/schema/printer_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Printer do
class PrinterTestSchema < GraphQL::Schema
module Node
include GraphQL::Schema::Interface
field :id, ID, null: false
end
class HiddenDirective < GraphQL::Schema::Directive
def self.visible?(ctx); fa... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/timeout_spec.rb | spec/graphql/schema/timeout_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Timeout do
module OtherTrace
def execute_field(query:, **opts)
query.context[:other_trace_worked] = true
super
end
end
class CustomTimeout < GraphQL::Schema::Timeout
def handle_timeout(error, query)
if qu... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/argument_spec.rb | spec/graphql/schema/argument_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Argument do
module SchemaArgumentTest
class UnauthorizedInstrumentType < Jazz::InstrumentType
def self.authorized?(_object, _context)
false
end
end
class ContextInput < GraphQL::Schema::InputObject
ar... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/resolver_spec.rb | spec/graphql/schema/resolver_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Resolver do
module ResolverTest
class SpecialError < StandardError
attr_accessor :id
end
class LazyBlock
def initialize(&block)
@get_value = block
end
def value
@get_value.call
en... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/list_spec.rb | spec/graphql/schema/list_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::List do
let(:of_type) { Jazz::Musician }
let(:list_type) { GraphQL::Schema::List.new(of_type) }
it "returns list? to be true" do
assert list_type.list?
end
it "returns non_null? to be false" do
refute list_type.non_null?... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/enum_value_spec.rb | spec/graphql/schema/enum_value_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::EnumValue do
describe "#path" do
it "Has the owner name too" do
enum = Class.new(GraphQL::Schema::Enum) do
graphql_name "Abc"
value(:XYZ)
end
assert_equal "Abc.XYZ", enum.values["XYZ"].path
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/has_single_input_argument_spec.rb | spec/graphql/schema/has_single_input_argument_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe GraphQL::Schema::HasSingleInputArgument do
describe ".input_object_class" do
it "is inherited, with a default" do
custom_input = Class.new(GraphQL::Schema::InputObject)
mutation_base_class = Class.new(GraphQL::Schema::Mutation) do
i... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/dynamic_members_spec.rb | spec/graphql/schema/dynamic_members_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "Dynamic types, fields, arguments, and enum values" do
class MultifieldSchema < GraphQL::Schema
use GraphQL::Schema::Warden if ADD_WARDEN
module AppliesToFutureSchema
def initialize(*args, future_schema: nil, **kwargs, &block)
@future... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/warden_spec.rb | spec/graphql/schema/warden_spec.rb | # frozen_string_literal: true
require "spec_helper"
module MaskHelpers
def self.build_mask(only:, except:)
->(member, context) do
visible = true
if visible
only.each do |filter|
passes_filter = filter.call(member, context)
if !passes_filter
visible = false
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | true |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/field_extension_spec.rb | spec/graphql/schema/field_extension_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::FieldExtension do
module FilterTestSchema
class DoubleFilter < GraphQL::Schema::FieldExtension
def after_resolve(object:, value:, arguments:, context:, memo:)
value * 2
end
end
class PowerOfFilter < GraphQL... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/ractor_shareable_spec.rb | spec/graphql/schema/ractor_shareable_spec.rb | # frozen_string_literal: true
require "spec_helper"
if RUN_RACTOR_TESTS
describe GraphQL::Schema::RactorShareable do
class RactorExampleSchema < GraphQL::Schema
class CustomError < RuntimeError; end
class SomeEnum < GraphQL::Schema::Enum
value :A
value :B
end
class Query ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/type_expression_spec.rb | spec/graphql/schema/type_expression_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::TypeExpression do
let(:ast_node) {
document = GraphQL.parse("query dostuff($var: #{type_name}) { id } ")
document.definitions.first.variables.first.type
}
let(:type_expression_result) { Dummy::Schema.type_from_ast(ast_node) }
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/member/build_type_spec.rb | spec/graphql/schema/member/build_type_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Member::BuildType do
describe ".parse_type" do
it "resolves a string type from a string" do
assert_equal GraphQL::Types::String, GraphQL::Schema::Member::BuildType.parse_type("String", null: true)
end
it "resolves an int... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/member/has_unresolved_type_error_spec.rb | spec/graphql/schema/member/has_unresolved_type_error_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Member::HasUnresolvedTypeError do
it "adds error classes to interfaces and unions" do
assert_equal Jazz::NamedEntity::UnresolvedTypeError.superclass, GraphQL::UnresolvedTypeError
assert_equal Jazz::PerformingAct::UnresolvedTypeErro... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/member/type_system_helpers_spec.rb | spec/graphql/schema/member/type_system_helpers_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Member::TypeSystemHelpers do
let(:object) {
Class.new(GraphQL::Schema::Object) do
graphql_name "Thing"
field :int, Integer
field :int2, Integer, null: false
field :int_list, [Integer]
field :int_list2, [I... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/member/relay_shortcuts_spec.rb | spec/graphql/schema/member/relay_shortcuts_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Member::RelayShortcuts do
describe ".connection_type_class, .edge_type_class" do
class CustomBaseConnectionType < GraphQL::Types::Relay::BaseConnection
end
class CustomEdgeType < GraphQL::Types::Relay::BaseEdge
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/schema/member/scoped_spec.rb | spec/graphql/schema/member/scoped_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Member::Scoped do
class ScopeSchema < GraphQL::Schema
class BaseObject < GraphQL::Schema::Object
end
class Item < BaseObject
def self.scope_items(items, context)
context[:scope_calls] ||= 0
context[:scope... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/member/has_arguments_spec.rb | spec/graphql/schema/member/has_arguments_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Member::HasArguments do
class DefaultArgumentAuthSchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
field :add, Int do
argument :left, Int
argument :right, Int, required: false, default_value: 1 do
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/member/has_dataloader_spec.rb | spec/graphql/schema/member/has_dataloader_spec.rb | # frozen_string_literal: true
require "spec_helper"
if testing_rails?
describe GraphQL::Schema::Member::HasDataloader do
class DataloaderExample
include GraphQL::Schema::Member::HasDataloader
def initialize(dataloader, object = nil)
@context = OpenStruct.new(dataloader: dataloader)
@o... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/visibility/profile_spec.rb | spec/graphql/schema/visibility/profile_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Visibility::Profile do
class ProfileSchema < GraphQL::Schema
class Thing < GraphQL::Schema::Object
field :name, String, method: :to_s
end
class Query < GraphQL::Schema::Object
field :thing, Thing, fallback_value: :... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/field/connection_extension_spec.rb | spec/graphql/schema/field/connection_extension_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Field::ConnectionExtension do
class ConnectionShortcutSchema < GraphQL::Schema
class ShortcutResolveExtension < GraphQL::Schema::FieldExtension
def resolve(arguments:, **rest)
collection = ["a", "b", "c", "d", "e"]
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/exclusion_validator_spec.rb | spec/graphql/schema/validator/exclusion_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::ExclusionValidator do
include ValidatorHelpers
expectations = [
{
config: { in: [1, 2, 3] },
cases: [
{ query: "{ validated(value: 1) }", result: nil, error_messa... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/required_validator_spec.rb | spec/graphql/schema/validator/required_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::RequiredValidator do
include ValidatorHelpers
expectations = [
{
config: { one_of: [:a, :b, :secret] },
cases: [
{ query: "{ validated: multiValidated(a: 1, b: 2)... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/inclusion_validator_spec.rb | spec/graphql/schema/validator/inclusion_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::InclusionValidator do
include ValidatorHelpers
expectations = [
{
config: { in: [1, 2, 3] },
cases: [
{ query: "{ validated(value: 1) }", result: 1, error_message... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/length_validator_spec.rb | spec/graphql/schema/validator/length_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::LengthValidator do
include ValidatorHelpers
it "allows blank and null" do
schema = build_schema(String, {length: { minimum: 5 }, allow_blank: true})
blank_string = ValidatorHelp... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/allow_null_validator_spec.rb | spec/graphql/schema/validator/allow_null_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::AllowNullValidator do
include ValidatorHelpers
it "allows nil when permitted" do
schema = build_schema(String, {length: { minimum: 5 }, allow_null: true})
result = schema.execute... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/all_validator_spec.rb | spec/graphql/schema/validator/all_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::AllValidator do
include ValidatorHelpers
expectations = [
{
config: { format: { with: /\A[a-z]+\Z/ } },
cases: [
{ query: "{ validated(value: []) }", result: [], ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/numericality_validator_spec.rb | spec/graphql/schema/validator/numericality_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::NumericalityValidator do
include ValidatorHelpers
expectations = [
{
config: { less_than: 10, greater_than: 2, allow_null: true },
cases: [
{ query: "{ validated(... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/validator_helpers.rb | spec/graphql/schema/validator/validator_helpers.rb | # frozen_string_literal: true
module ValidatorHelpers
def self.included(child_class)
child_class.extend(ClassMethods)
end
class BlankString < String
def blank?
true
end
end
class NonBlankString < String
if method_defined?(:blank?)
undef :blank?
end
end
def build_schema(... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/allow_blank_validator_spec.rb | spec/graphql/schema/validator/allow_blank_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::AllowBlankValidator do
include ValidatorHelpers
it "allows blank when configured" do
schema = build_schema(String, {length: { minimum: 5 }, allow_blank: true})
result = schema.ex... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/validator/format_validator_spec.rb | spec/graphql/schema/validator/format_validator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require_relative "./validator_helpers"
describe GraphQL::Schema::Validator::FormatValidator do
include ValidatorHelpers
expectations = [
{
config: { with: /\A[a-z]+\Z/ },
cases: [
{ query: "{ validated(value: \"abcd\") }", result: "abcd",... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/directive/query_level_directive_spec.rb | spec/graphql/schema/directive/query_level_directive_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe "Query level Directive" do
class QueryDirectiveSchema < GraphQL::Schema
class DirectiveInput < GraphQL::Schema::InputObject
argument :val, Integer
end
class InitInt < GraphQL::Schema::Directive
locations(GraphQL::Schema::Directive:... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/directive/transform_spec.rb | spec/graphql/schema/directive/transform_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Directive::Transform do
class TransformSchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
field :echo, String, null: false do
argument :input, String
end
def echo(input:)
input
end
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/directive/feature_spec.rb | spec/graphql/schema/directive/feature_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Directive::Feature do
class FeatureSchema < GraphQL::Schema
class Feature < GraphQL::Schema::Directive::Feature
def self.enabled?(flag_name, obj, ctx)
!!ctx[flag_name.to_sym]
end
end
# Based on feature but ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/directive/one_of_spec.rb | spec/graphql/schema/directive/one_of_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Directive::OneOf do
let(:schema) do
this = self
output_type = Class.new(GraphQL::Schema::Object) do
graphql_name "OneOfOutput"
field :string, GraphQL::Types::String
field :int, GraphQL::Types::Int
end
qu... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/schema/directive/flagged_spec.rb | spec/graphql/schema/directive/flagged_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Directive::Flagged do
class FlaggedSchema < GraphQL::Schema
use GraphQL::Schema::Warden if ADD_WARDEN
module Animal
include GraphQL::Schema::Interface
if GraphQL::Schema.use_visibility_profile?
# It won't check ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/dataloader/source_spec.rb | spec/graphql/dataloader/source_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Dataloader::Source do
class FailsToLoadSource < GraphQL::Dataloader::Source
def fetch(keys)
dataloader.with(FailsToLoadSource).load_all(keys)
end
end
it "raises an error when it tries too many times to sync" do
dl = GraphQL:... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/dataloader/nonblocking_dataloader_spec.rb | spec/graphql/dataloader/nonblocking_dataloader_spec.rb | # frozen_string_literal: true
require "spec_helper"
if Fiber.respond_to?(:scheduler) # Ruby 3+
describe "GraphQL::Dataloader::NonblockingDataloader" do
class NonblockingSchema < GraphQL::Schema
class SleepSource < GraphQL::Dataloader::Source
def fetch(keys)
max_sleep = keys.max
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/dataloader/active_record_source_spec.rb | spec/graphql/dataloader/active_record_source_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Dataloader::ActiveRecordSource do
if testing_rails?
describe "finding by ID" do
it_dataloads "loads once, then returns from a cache when available" do |d|
log = with_active_record_log(colorize: false) do
r1 = d.with(Gra... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/dataloader/active_record_association_source_spec.rb | spec/graphql/dataloader/active_record_association_source_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Dataloader::ActiveRecordAssociationSource do
if testing_rails?
class VulfpeckSchema < GraphQL::Schema
class Album < GraphQL::Schema::Object
field :name, String
end
class Band < GraphQL::Schema::Object
field :a... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/dataloader/async_dataloader_spec.rb | spec/graphql/dataloader/async_dataloader_spec.rb | # frozen_string_literal: true
require "spec_helper"
if RUBY_VERSION >= "3.2.0"
require "async"
describe GraphQL::Dataloader::AsyncDataloader do
class AsyncSchema < GraphQL::Schema
class SleepSource < GraphQL::Dataloader::Source
def initialize(tag = nil)
@tag = tag
end
de... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/graphql/type_kinds/type_kind_spec.rb | spec/graphql/type_kinds/type_kind_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::TypeKinds::TypeKind do
describe ".leaf?" do
it "is true for enums and scalars, but false for others" do
assert GraphQL::Schema::Scalar.kind.leaf?
assert GraphQL::Schema::Enum.kind.leaf?
refute GraphQL::Schema::Object.kind.lea... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/jobs/application_job.rb | spec/dummy/app/jobs/application_job.rb | # frozen_string_literal: true
class ApplicationJob < ActiveJob::Base
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/helpers/application_helper.rb | spec/dummy/app/helpers/application_helper.rb | # frozen_string_literal: true
module ApplicationHelper
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/graphql/dummy_schema.rb | spec/dummy/app/graphql/dummy_schema.rb | # frozen_string_literal: true
begin
require "graphql-pro"
rescue LoadError => err
puts "Skipping GraphQL::Pro: #{err.message}"
end
class DummySchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
field :str, String, fallback_value: "hello"
field :sleep, Float do
argument :seconds, Float
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/graphql/mock_pusher.rb | spec/dummy/app/graphql/mock_pusher.rb | # frozen_string_literal: true
class MockPusher
class Channel
attr_reader :id, :occupants
def initialize(id)
@id = id
@occupants = 0
@inboxes = [[]]
end
def trigger(event_name, payload)
if event_name != "update"
raise "Invariant: GraphQL is only expected to call update... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/graphql/not_installed_schema.rb | spec/dummy/app/graphql/not_installed_schema.rb | # frozen_string_literal: true
class NotInstalledSchema < GraphQL::Schema
class Query < GraphQL::Schema::Object
field :str, String, fallback_value: "hello"
end
query(Query)
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/controllers/pages_controller.rb | spec/dummy/app/controllers/pages_controller.rb | # frozen_string_literal: true
class PagesController < ApplicationController
def show
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/controllers/application_controller.rb | spec/dummy/app/controllers/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/channels/graphql_channel.rb | spec/dummy/app/channels/graphql_channel.rb | # frozen_string_literal: true
class GraphqlChannel < ActionCable::Channel::Base
class QueryType < GraphQL::Schema::Object
field :value, Integer, null: false
def value
3
end
end
class PayloadType < GraphQL::Schema::Object
field :value, Integer, null: false
end
class CounterIncremented <... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/channels/application_cable/channel.rb | spec/dummy/app/channels/application_cable/channel.rb | # frozen_string_literal: true
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/app/channels/application_cable/connection.rb | spec/dummy/app/channels/application_cable/connection.rb | # frozen_string_literal: true
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/application_system_test_case.rb | spec/dummy/test/application_system_test_case.rb | # frozen_string_literal: true
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/test_helper.rb | spec/dummy/test/test_helper.rb | # frozen_string_literal: true
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/system/action_cable_subscription_test.rb | spec/dummy/test/system/action_cable_subscription_test.rb | # frozen_string_literal: true
require "application_system_test_case"
class ActionCableSubscriptionsTest < ApplicationSystemTestCase
setup do
ActionCable.server.config.logger = Logger.new(STDOUT)
end
# This test covers a lot of ground!
test "it handles subscriptions" do
# Load the page and let the subsc... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/application_controller_test.rb | spec/dummy/test/controllers/dashboard/application_controller_test.rb | # frozen_string_literal: true
require "test_helper"
class DashboardApplicationControllerTest < ActionDispatch::IntegrationTest
def test_it_calls_on_load_hook
assert_equal true, GraphQL::Dashboard::ApplicationController.hook_was_called?
end
end
| ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/statics_controller_test.rb | spec/dummy/test/controllers/dashboard/statics_controller_test.rb | # frozen_string_literal: true
require "test_helper"
class DashboardStaticsControllerTest < ActionDispatch::IntegrationTest
def test_it_serves_assets
get graphql_dashboard.static_path("dashboard.css")
assert_includes response.body, "#header-icon {"
assert_equal response.headers["Cache-Control"], "max-age=... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/landings_controller_test.rb | spec/dummy/test/controllers/dashboard/landings_controller_test.rb | # frozen_string_literal: true
require "test_helper"
class DashboardLandingsControllerTest < ActionDispatch::IntegrationTest
def test_it_shows_a_landing_page
get graphql_dashboard.root_path
assert_includes response.body, "Welcome to the GraphQL-Ruby Dashboard"
end
def test_it_shows_version_and_schema_inf... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/subscriptions/topics_controller_test.rb | spec/dummy/test/controllers/dashboard/subscriptions/topics_controller_test.rb | # frozen_string_literal: true
require "test_helper"
require "ostruct" # TODO use a real class in RedisBackend
if defined?(GraphQL::Pro)
class DashboardSubscriptionsTopicsControllerTest < ActionDispatch::IntegrationTest
def test_it_checks_installed
get graphql_dashboard.subscriptions_topics_path, params: { ... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/limiters/limiters_controller_test.rb | spec/dummy/test/controllers/dashboard/limiters/limiters_controller_test.rb | # frozen_string_literal: true
require "test_helper"
if defined?(GraphQL::Pro)
class DashboardLimitersLimitersControllerTest < ActionDispatch::IntegrationTest
def test_it_checks_installed
get graphql_dashboard.limiters_limiter_path("runtime", { schema: "GraphQL::Schema" })
assert_includes response.bod... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/operation_store/clients_controller_test.rb | spec/dummy/test/controllers/dashboard/operation_store/clients_controller_test.rb | # frozen_string_literal: true
require "test_helper"
if defined?(GraphQL::Pro)
class DashboardOperationStoreClientsControllerTest < ActionDispatch::IntegrationTest
def test_it_manages_clients
assert_equal 0, DummySchema.operation_store.all_clients(page: 1, per_page: 1).total_count
get graphql_dashboar... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/operation_store/operations_controller_test.rb | spec/dummy/test/controllers/dashboard/operation_store/operations_controller_test.rb | # frozen_string_literal: true
require "test_helper"
if defined?(GraphQL::Pro)
class DashboardOperationStoreOperationsControllerTest < ActionDispatch::IntegrationTest
def teardown
DummySchema.operation_store.delete_client("client-1")
DummySchema.operation_store.delete_client("client-2")
super
... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/operation_store/index_entries_controller_test.rb | spec/dummy/test/controllers/dashboard/operation_store/index_entries_controller_test.rb | # frozen_string_literal: true
require "test_helper"
if defined?(GraphQL::Pro)
class DashboardOperationStoreIndexEntriesControllerTest < ActionDispatch::IntegrationTest
def test_it_shows_entries
DummySchema.operation_store.upsert_client("client-1", "abcdef")
DummySchema.operation_store.add(body: "quer... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/controllers/dashboard/detailed_traces/traces_controller_test.rb | spec/dummy/test/controllers/dashboard/detailed_traces/traces_controller_test.rb | # frozen_string_literal: true
require "test_helper"
class DashboardTracesControllerTest < ActionDispatch::IntegrationTest
def teardown
DummySchema.detailed_trace.delete_all_traces
end
def test_it_renders_not_installed
get graphql_dashboard.detailed_traces_traces_path, params: { schema: "NotInstalledSche... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/test/channels/graphql_channel_test.rb | spec/dummy/test/channels/graphql_channel_test.rb | # frozen_string_literal: true
require "test_helper"
class GraphqlChannelTest < ActionCable::Channel::TestCase
module RealChannelStub
def confirmed?
subscription_confirmation_sent?
end
def real_streams
streams
end
end
def assert_has_real_stream(stream_name)
assert subscription.re... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/config/application.rb | spec/dummy/config/application.rb | # frozen_string_literal: true
require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "action_controller/railtie"
require "action_view/railtie"
require "action_cable/engine"
require "sprockets/railtie"
require "rails/test_unit/railtie"... | ruby | MIT | fa2ba4e489f8475b194f7c6985e0b25681a442c2 | 2026-01-04T15:43:02.089024Z | false |
rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby/blob/fa2ba4e489f8475b194f7c6985e0b25681a442c2/spec/dummy/config/environment.rb | spec/dummy/config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
| 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.