Skip to content

Instantly share code, notes, and snippets.

@Lucas-Barret
Last active October 12, 2023 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lucas-Barret/b3db09d231165703e5f31ba52487ec60 to your computer and use it in GitHub Desktop.
Save Lucas-Barret/b3db09d231165703e5f31ba52487ec60 to your computer and use it in GitHub Desktop.
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'graphql'
gem 'minitest'
end
require 'minitest/autorun'
class SchemaTest < GraphQL::Schema
class Testable < GraphQL::Schema::Object
field :tested, Boolean
end
class Query < GraphQL::Schema::Object
field :testable, Testable , null: true
def testable
{ tested: true }
end
end
query(Query)
end
class TestMeme < Minitest::Test
def setup
@query = <<-GQL
{
testable {
name
}
}
GQL
end
def test_that_kitty_can_eat
assert_equal SchemaTest.execute(@query).to_h.dig('data','testable'), {"tested"=>true}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment