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

2
spec/lib/tasks/form_definition_validator_spec.rb

@ -11,7 +11,7 @@ describe "rake form_definition:validate_all", type: :task do
end
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
end
end

Loading…
Cancel
Save