diff --git a/lib/tasks/form_definition.rake b/lib/tasks/form_definition.rake index 4da4a0ff4..50b649d5e 100644 --- a/lib/tasks/form_definition.rake +++ b/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 diff --git a/spec/lib/tasks/form_definition_validator_spec.rb b/spec/lib/tasks/form_definition_validator_spec.rb index 55479fe7b..a85664b7d 100644 --- a/spec/lib/tasks/form_definition_validator_spec.rb +++ b/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