Sha256: 52b6262c27790bbe485e3469f9be40fed44ad92be5eb0a1b773ded53a03e4dc8
Contents?: true
Size: 610 Bytes
Versions: 10
Compression:
Stored size: 610 Bytes
Contents
def expected_policy_behavior(policy:, policy_args: [], input:, output: nil, errors: {}, environment: {}, ignore_for: []) output ||= input schema = Paradocs::Schema.new do input.map do |key, value| instruction = ignore_for.include?(key) ? -> { field(key) } : -> { field(key).policy(*([policy] + policy_args)) } instance_exec &instruction end end if block_given? || output.nil? expect { schema.resolve(input, environment) }.to yield else result = schema.resolve(input, environment) expect(result.output).to eq(output) expect(result.errors).to eq(errors) end end
Version data entries
10 entries across 10 versions & 1 rubygems