spec/schema_spec.rb in parametric-0.1.2 vs spec/schema_spec.rb in parametric-0.1.3

- old
+ new

@@ -94,9 +94,20 @@ expect(results.valid?).to be false expect(results.errors['$.variants[1].name']).not_to be_nil end end + it "ignores nil fields if using :declared policy" do + schema = described_class.new do + field(:id).type(:integer) + field(:title).declared.type(:string) + end + + resolve(schema, {id: 123}) do |results| + expect(results.output.keys).to eq [:id] + end + end + describe "#policy" do it "applies policy to all fields" do subject.policy(:declared) resolve(subject, {}) do |results|