Skip to content

Commit 2edf9e7

Browse files
committed
Adding regression tests for warden.from_context
1 parent c437a55 commit 2edf9e7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

spec/graphql/schema/warden_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,4 +961,15 @@ def self.visible?(member, context)
961961
end
962962
end
963963
end
964+
965+
describe "PassThruWarden is used when no warden is used" do
966+
it "uses PassThruWarden when a hash is used for context" do
967+
assert_equal GraphQL::Schema::Warden::PassThruWarden, GraphQL::Schema::Warden.from_context({})
968+
end
969+
970+
it "uses PassThruWarden when a warden on the context nor query" do
971+
context = GraphQL::Query::Context.new(query: OpenStruct.new(schema: GraphQL::Schema.new), values: {}, object: nil)
972+
assert_equal GraphQL::Schema::Warden::PassThruWarden, GraphQL::Schema::Warden.from_context(context)
973+
end
974+
end
964975
end

0 commit comments

Comments
 (0)