source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/tracing/detailed_trace/active_record_backend_spec.rb | Ruby | mit | 5,430 | master | 762 | # frozen_string_literal: true
require "spec_helper"
require_relative "./backend_assertions"
if testing_rails?
describe GraphQL::Tracing::DetailedTrace::ActiveRecordBackend do
include GraphQLTracingDetailedTraceBackendAssertions
def new_backend(**kwargs)
GraphQL::Tracing::DetailedTrace::ActiveRecordBack... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/tracing/detailed_trace/memory_backend_spec.rb | Ruby | mit | 5,430 | master | 310 | # frozen_string_literal: true
require "spec_helper"
require_relative "./backend_assertions"
describe GraphQL::Tracing::DetailedTrace::MemoryBackend do
include GraphQLTracingDetailedTraceBackendAssertions
def new_backend(**kwargs)
GraphQL::Tracing::DetailedTrace::MemoryBackend.new(**kwargs)
end
end |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/tracing/detailed_trace/redis_backend_spec.rb | Ruby | mit | 5,430 | master | 360 | # frozen_string_literal: true
require "spec_helper"
require_relative "./backend_assertions"
if testing_redis?
describe GraphQL::Tracing::DetailedTrace::RedisBackend do
include GraphQLTracingDetailedTraceBackendAssertions
def new_backend(**kwargs)
GraphQL::Tracing::DetailedTrace::RedisBackend.new(redis:... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/tracing/detailed_trace/backend_assertions.rb | Ruby | mit | 5,430 | master | 3,197 | # frozen_string_literal: true
module GraphQLTracingDetailedTraceBackendAssertions
def self.included(child_class)
child_class.instance_eval do
describe "BackendAssertions" do
before do
@backend = new_backend
@backend.delete_all_traces
end
it "can save, retreive, ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/introspection/input_value_type_spec.rb | Ruby | mit | 5,430 | master | 3,512 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Introspection::InputValueType do
let(:query_string) {%|
{
__type(name: "DairyProductInput") {
name
description
kind
inputFields {
name
type { kind, name }
defaultVal... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/introspection/type_type_spec.rb | Ruby | mit | 5,430 | master | 9,511 | # 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: "... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/introspection/schema_type_spec.rb | Ruby | mit | 5,430 | master | 5,929 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Introspection::SchemaType do
let(:schema) { Class.new(Dummy::Schema) { description("Cool schema") }}
let(:query_string) {%|
query getSchema {
__schema {
description
types { name }
queryType { fields { name }}
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/introspection/introspection_query_spec.rb | Ruby | mit | 5,430 | master | 1,576 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/introspection/directive_type_spec.rb | Ruby | mit | 5,430 | master | 4,876 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/introspection/entry_points_spec.rb | Ruby | mit | 5,430 | master | 1,660 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Introspection::EntryPoints do
describe "#__type" do
let(:schema) do
nested_invisible_type = Class.new(GraphQL::Schema::Object) do
graphql_name 'NestedInvisible'
field :foo, String, null: false
end
invisible_t... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/partial_spec.rb | Ruby | mit | 5,430 | master | 18,369 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/variables_spec.rb | Ruby | mit | 5,430 | master | 4,061 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/context_spec.rb | Ruby | mit | 5,430 | master | 15,334 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/fingerprint_spec.rb | Ruby | mit | 5,430 | master | 3,769 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/executor_spec.rb | Ruby | mit | 5,430 | master | 10,432 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/variable_validation_error_spec.rb | Ruby | mit | 5,430 | master | 1,627 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/result_spec.rb | Ruby | mit | 5,430 | master | 1,024 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/null_context_spec.rb | Ruby | mit | 5,430 | master | 875 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/query/context/scoped_context_spec.rb | Ruby | mit | 5,430 | master | 2,394 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/subscriptions/event_spec.rb | Ruby | mit | 5,430 | master | 3,783 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/subscriptions/serialize_spec.rb | Ruby | mit | 5,430 | master | 4,841 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/subscriptions/action_cable_subscriptions_spec.rb | Ruby | mit | 5,430 | master | 11,316 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/subscriptions/broadcast_analyzer_spec.rb | Ruby | mit | 5,430 | master | 7,238 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/id_spec.rb | Ruby | mit | 5,430 | master | 1,187 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::ID do
let(:result) { Dummy::Schema.execute(query_string)}
describe "coercion for int inputs" do
let(:query_string) { %|query getMilk { cow: milk(id: 1) { id } }| }
it "coerces IDs from ints and serializes as strings" do
ex... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/iso_8601_date_spec.rb | Ruby | mit | 5,430 | master | 8,707 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::ISO8601Date do
module DateTest
class DateObject < GraphQL::Schema::Object
field :year, Integer, null: false
field :month, Integer, null: false
field :day, Integer, null: false
field :iso8601, GraphQL::Types::ISO8... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/int_spec.rb | Ruby | mit | 5,430 | master | 2,223 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Int do
describe "coerce_input" do
it "accepts ints within the bounds" do
assert_equal(-(2**31), GraphQL::Types::Int.coerce_isolated_input(-(2**31)))
assert_equal 1, GraphQL::Types::Int.coerce_isolated_input(1)
assert_e... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/iso_8601_date_time_spec.rb | Ruby | mit | 5,430 | master | 8,352 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::ISO8601DateTime do
module DateTimeTest
class DateTimeObject < GraphQL::Schema::Object
field :year, Integer, null: false
field :month, Integer, null: false
field :day, Integer, null: false
field :hour, Integer, nu... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/string_spec.rb | Ruby | mit | 5,430 | master | 4,678 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::String do
let(:string_type) { GraphQL::Types::String }
it "is a default scalar" do
assert_equal(true, string_type.default_scalar?)
end
describe "coerce_result" do
let(:utf_8_str) { "foobar" }
let(:ascii_str) { "foobar".e... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/big_int_spec.rb | Ruby | mit | 5,430 | master | 1,555 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::BigInt do
it "encodes big and small integers as strings" do
big_integer_1 = 99**99
expected_str_1 = "36972963764972677265718790562880544059566876428174110243025997242355257045527752342141065001012823272794097888954832654011942999676... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/float_spec.rb | Ruby | mit | 5,430 | master | 623 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Float do
let(:enum) { GraphQL::Language::Nodes::Enum.new(name: 'MILK') }
describe "coerce_input" do
it "accepts ints and floats" do
assert_equal 1.0, GraphQL::Types::Float.coerce_isolated_input(1)
assert_equal 6.1, GraphQ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/boolean_spec.rb | Ruby | mit | 5,430 | master | 506 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Boolean do
describe "coerce_input" do
def coerce_input(input)
GraphQL::Types::Boolean.coerce_isolated_input(input)
end
it "accepts true and false" do
assert_equal true, coerce_input(true)
assert_equal false, c... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/relay/has_node_field_spec.rb | Ruby | mit | 5,430 | master | 599 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Relay::HasNodeField do
it "populates .owner when it's included" do
query = Class.new(GraphQL::Schema::Object) do
graphql_name "Query"
include GraphQL::Types::Relay::HasNodeField
include GraphQL::Types::Relay::HasNodesF... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/relay/base_connection_spec.rb | Ruby | mit | 5,430 | master | 4,464 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Relay::BaseConnection do
module NonNullAbleNodeDummy
class Node < GraphQL::Schema::Object
field :some_field, String
end
class NodeEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(Node, null: false)
end
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/relay/node_behaviors_spec.rb | Ruby | mit | 5,430 | master | 974 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Relay::NodeBehaviors do
class NodeBehaviorsSchema < GraphQL::Schema
class Thing < GraphQL::Schema::Object
implements GraphQL::Types::Relay::Node
end
class Query < GraphQL::Schema::Object
field :thing, Thing, resolve... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/types/relay/base_edge_spec.rb | Ruby | mit | 5,430 | master | 2,104 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Types::Relay::BaseEdge do
module NonNullableDummy
class NonNullableNode < GraphQL::Schema::Object
field :some_field, String
end
class NonNullableNodeEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(NonNullableNode, nul... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/pagination/mongoid_relation_connection_spec.rb | Ruby | mit | 5,430 | master | 830 | # frozen_string_literal: true
require "spec_helper"
if testing_mongoid?
describe GraphQL::Pagination::MongoidRelationConnection do
class Food
include Mongoid::Document
field :name, type: String
end
before do
# Populate the DB
Food.collection.drop
ConnectionAssertions::NAMES... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/pagination/connections_spec.rb | Ruby | mit | 5,430 | master | 5,910 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Pagination::Connections do
ITEMS = ConnectionAssertions::NAMES.map { |n| { name: n } }
class ArrayConnectionWithTotalCount < GraphQL::Pagination::ArrayConnection
def total_count
items.size
end
end
let(:base_schema) {
Conn... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/pagination/sequel_dataset_connection_spec.rb | Ruby | mit | 5,430 | master | 843 | # frozen_string_literal: true
require "spec_helper"
if testing_rails?
describe GraphQL::Pagination::SequelDatasetConnection do
class SequelFood < Sequel::Model(:foods)
end
before do
if SequelFood.empty? # Can overlap with ActiveRecordRelationConnection test
ConnectionAssertions::NAMES.each... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/pagination/array_connection_spec.rb | Ruby | mit | 5,430 | master | 575 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Pagination::ArrayConnection do
ARRAY_ITEMS = ConnectionAssertions::NAMES.map { |n| { name: n } }
class ArrayTestConnectionWithTotalCount < GraphQL::Pagination::ArrayConnection
def total_count
items.size
end
end
let(:schema) {... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/pagination/connection_spec.rb | Ruby | mit | 5,430 | master | 811 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Pagination::Connection do
describe "was_authorized_by_scope_ites?" do
it "doesn't raise an error for missing runtime state and it updates it if context is assigned later" do
context = GraphQL::Query.new(GraphQL::Schema, "{ __typename }")... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/pagination/active_record_relation_connection_spec.rb | Ruby | mit | 5,430 | master | 9,375 | # frozen_string_literal: true
require "spec_helper"
if testing_rails?
describe GraphQL::Pagination::ActiveRecordRelationConnection do
class RelationConnectionWithTotalCount < GraphQL::Pagination::ActiveRecordRelationConnection
def total_count
if items.respond_to?(:unscope)
items.unscope(:... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/testing/helpers_spec.rb | Ruby | mit | 5,430 | master | 9,457 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Testing::Helpers do
class AssertionsSchema < GraphQL::Schema
use GraphQL::Schema::Warden if ADD_WARDEN
class BillSource < GraphQL::Dataloader::Source
def fetch(students)
students.map { |s| { amount: 1_000_001 } }
end
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/non_null_spec.rb | Ruby | mit | 5,430 | master | 2,361 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/instrumentation_spec.rb | Ruby | mit | 5,430 | master | 545 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/field_spec.rb | Ruby | mit | 5,430 | master | 33,306 | # 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 "Que... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/enum_spec.rb | Ruby | mit | 5,430 | master | 13,223 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/object_spec.rb | Ruby | mit | 5,430 | master | 18,307 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/addition_spec.rb | Ruby | mit | 5,430 | master | 544 | # 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::... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/finder_spec.rb | Ruby | mit | 5,430 | master | 4,339 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/scalar_spec.rb | Ruby | mit | 5,430 | master | 7,110 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/relay_classic_mutation_spec.rb | Ruby | mit | 5,430 | master | 21,623 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/ractor_shareable_spec.rb | Ruby | mit | 5,430 | master | 4,098 | # 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 ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/union_spec.rb | Ruby | mit | 5,430 | master | 12,117 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/field_extension_spec.rb | Ruby | mit | 5,430 | master | 16,185 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::FieldExtension do
module FilterTestSchema
class DoubleFilter < GraphQL::Schema::FieldExtension
def after_resolve(object: nil, objects: nil, values: nil, value: nil, arguments:, context:, memo:)
values ? values.map { |v| v... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/list_spec.rb | Ruby | mit | 5,430 | master | 6,659 | # 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?... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/argument_spec.rb | Ruby | mit | 5,430 | master | 28,390 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/directive_spec.rb | Ruby | mit | 5,430 | master | 20,185 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/unique_within_type_spec.rb | Ruby | mit | 5,430 | master | 2,330 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/input_object_spec.rb | Ruby | mit | 5,430 | master | 50,442 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/has_single_input_argument_spec.rb | Ruby | mit | 5,430 | master | 6,334 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/mutation_spec.rb | Ruby | mit | 5,430 | master | 11,526 | # 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_... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/always_visible_spec.rb | Ruby | mit | 5,430 | master | 920 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/dynamic_members_spec.rb | Ruby | mit | 5,430 | master | 51,382 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/enum_value_spec.rb | Ruby | mit | 5,430 | master | 1,036 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/warden_spec.rb | Ruby | mit | 5,430 | master | 33,926 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/visibility_spec.rb | Ruby | mit | 5,430 | master | 12,628 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/introspection_system_spec.rb | Ruby | mit | 5,430 | master | 12,412 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::IntrospectionSystem do
def execute_query(...)
if TESTING_EXEC_NEXT
Jazz::Schema.execute_next(...)
else
Jazz::Schema.execute(...)
end
end
describe "custom introspection" do
it "serves custom fields on types... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/type_expression_spec.rb | Ruby | mit | 5,430 | master | 1,075 | # 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) }
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/printer_spec.rb | Ruby | mit | 5,430 | master | 23,292 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/loader_spec.rb | Ruby | mit | 5,430 | master | 21,307 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/subscription_spec.rb | Ruby | mit | 5,430 | master | 26,393 | # 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}... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/interface_spec.rb | Ruby | mit | 5,430 | master | 20,442 | # 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" ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/base_64_encoder_spec.rb | Ruby | mit | 5,430 | master | 586 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/timeout_spec.rb | Ruby | mit | 5,430 | master | 7,598 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/resolver_spec.rb | Ruby | mit | 5,430 | master | 41,419 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator_spec.rb | Ruby | mit | 5,430 | master | 7,104 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/build_from_definition_spec.rb | Ruby | mit | 5,430 | master | 47,041 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/field/connection_extension_spec.rb | Ruby | mit | 5,430 | master | 1,654 | # 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"]
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/directive/query_level_directive_spec.rb | Ruby | mit | 5,430 | master | 2,265 | # 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:... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/directive/flagged_spec.rb | Ruby | mit | 5,430 | master | 3,687 | # 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 ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/directive/transform_spec.rb | Ruby | mit | 5,430 | master | 937 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/directive/feature_spec.rb | Ruby | mit | 5,430 | master | 2,940 | # 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 ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/directive/one_of_spec.rb | Ruby | mit | 5,430 | master | 5,492 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/required_validator_spec.rb | Ruby | mit | 5,430 | master | 10,679 | # 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)... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/exclusion_validator_spec.rb | Ruby | mit | 5,430 | master | 584 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/validator_helpers.rb | Ruby | mit | 5,430 | master | 4,700 | # 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(... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/length_validator_spec.rb | Ruby | mit | 5,430 | master | 6,865 | # 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
build_schema(String, {length: { minimum: 5 }, allow_blank: true})
blank_string = ValidatorHelpers::Blan... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/inclusion_validator_spec.rb | Ruby | mit | 5,430 | master | 995 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/allow_null_validator_spec.rb | Ruby | mit | 5,430 | master | 1,506 | # 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
build_schema(String, {length: { minimum: 5 }, allow_null: true})
result = exec_query("query($str:... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/allow_blank_validator_spec.rb | Ruby | mit | 5,430 | master | 1,921 | # 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
build_schema(String, {length: { minimum: 5 }, allow_blank: true})
result = exec_query("query(... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/all_validator_spec.rb | Ruby | mit | 5,430 | master | 3,337 | # 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: [], ... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/numericality_validator_spec.rb | Ruby | mit | 5,430 | master | 2,875 | # 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(... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/validator/format_validator_spec.rb | Ruby | mit | 5,430 | master | 1,410 | # 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",... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/member/build_type_spec.rb | Ruby | mit | 5,430 | master | 3,065 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/member/has_arguments_spec.rb | Ruby | mit | 5,430 | master | 1,058 | # 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
... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/member/has_authorization_spec.rb | Ruby | mit | 5,430 | master | 5,798 | # frozen_string_literal: true
require "spec_helper"
describe 'Has Authorization' do
module HasAuthorization
class Schema < GraphQL::Schema
use GraphQL::Schema::Visibility
end
module DefinesAuthorized
def authorized?(*whatever)
false
end
end
class BaseArgument < GraphQL:... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/member/type_system_helpers_spec.rb | Ruby | mit | 5,430 | master | 1,843 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/member/has_dataloader_spec.rb | Ruby | mit | 5,430 | master | 2,828 | # 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... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/member/scoped_spec.rb | Ruby | mit | 5,430 | master | 11,792 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Member::Scoped do
class ScopeSchema < GraphQL::Schema
class BaseObject < GraphQL::Schema::Object
class BaseField < GraphQL::Schema::Field
end
field_class BaseField
end
class Item < BaseObject
def self.s... |
github | rmosolgo/graphql-ruby | https://github.com/rmosolgo/graphql-ruby | spec/graphql/schema/member/relay_shortcuts_spec.rb | Ruby | mit | 5,430 | master | 1,871 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.