Browse Source

fix one validation test

pull/91/head
magicmilo 3 years ago
parent
commit
ef32e2ba67
  1. 6
      lib/tasks/form_definition.rake
  2. 2
      spec/lib/tasks/form_definition_validator_spec.rb

6
lib/tasks/form_definition.rake

@ -29,7 +29,7 @@ namespace :form_definition do
puts args puts args
path = "config/forms/schema/generic.json" path = Rails.root.join("config/forms/schema/generic.json")
file = File.open(path) file = File.open(path)
schema = JSON.parse(file.read) schema = JSON.parse(file.read)
meta_schema = JSON::Validator.validator_for_name("draft4").metaschema meta_schema = JSON::Validator.validator_for_name("draft4").metaschema
@ -37,9 +37,9 @@ namespace :form_definition do
puts path puts path
if JSON::Validator.validate(meta_schema, schema) if JSON::Validator.validate(meta_schema, schema)
puts "schema valid" puts "Schema Definition is Valid"
else else
puts "schema not valid" puts "Schema Definition in #{path} is not valid against draft4 json schema."
return return
end end

2
spec/lib/tasks/form_definition_validator_spec.rb

@ -11,7 +11,7 @@ describe "rake form_definition:validate_all", type: :task do
end end
it "runs the validate task for each form definition in the project" do it "runs the validate task for each form definition in the project" do
expect(Rake::Task["form_definition:validate"]).to receive(:invoke).exactly(5).times expect(Rake::Task["form_definition:validate"]).to receive(:invoke).exactly(4).times
task.invoke task.invoke
end end
end end

Loading…
Cancel
Save