File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
spec/lib/canvas/validators Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 450450 }
451451 }
452452
453- it "returns true" do
454- expect ( validator . validate ) . to eq ( true )
453+ %w[ card Card ] . each do |key |
454+ %w[ card Card ] . each do |type |
455+ it "resolves type declaration #{ type } when type key is #{ key } " do
456+ card_type [ "key" ] = key
457+ attribute [ "type" ] = type
458+ expect ( validator . validate ) . to eq ( true )
459+ end
460+ end
461+ end
462+
463+ context "when the type is undefined" do
464+ let ( :attribute ) {
465+ {
466+ "name" => "my_card" ,
467+ "type" => "undefined_custom_type"
468+ }
469+ }
470+
471+ it "marks undefined type references as invalid" do
472+ expect ( validator . validate ) . to eq ( false )
473+ expect ( validator . errors ) . to include ( /"type" must be one of: .*, card/ )
474+ end
455475 end
456476
457477 context "when array is true and custom type includes nonarray supported types" do
You can’t perform that action at this time.
0 commit comments