spec/graphql/query/context_spec.rb in graphql-1.8.0.pre2 vs spec/graphql/query/context_spec.rb in graphql-1.8.0.pre3

- old
+ new

@@ -241,6 +241,23 @@ it "allows query-level errors" do expected_err = { "message" => "Query-level error" } assert_equal [expected_err], result["errors"] end end + + describe "custom context class" do + it "can be specified" do + query_str = '{ + inspectContext + find(id: "Musician/Herbie Hancock") { + ... on Musician { + inspectContext + } + } + }' + res = Jazz::Schema.execute(query_str, context: { magic_key: :ignored, normal_key: "normal_value" }) + expected_values = ["custom_method", "magic_value", "normal_value"] + assert_equal expected_values, res["data"]["inspectContext"] + assert_equal expected_values, res["data"]["find"]["inspectContext"] + end + end end