Browse Source

rubocop

pull/88/head
baarkerlounger 3 years ago
parent
commit
92ffab0c3d
  1. 2
      Gemfile
  2. 1
      db/migrate/20211112105348_add_incref_field.rb
  3. 9
      lib/tasks/form_definition.rake

2
Gemfile

@ -29,7 +29,7 @@ gem "discard"
gem "activeadmin"
# Admin charts
gem "chartkick"
#Json Schema
# Json Schema
gem "json-schema"
gem "uk_postcode"

1
db/migrate/20211112105348_add_incref_field.rb

@ -5,4 +5,3 @@ class AddIncrefField < ActiveRecord::Migration[6.1]
end
end
end

9
lib/tasks/form_definition.rake

@ -13,8 +13,8 @@ end
namespace :form_definition do
desc "Validate JSON against Generic Form Schema"
task :validate do
puts "#{Rails.root}"
task validate: :environment do
puts Rails.root.to_s
path = "config/forms/schema/generic.json"
file = File.open(path)
@ -31,14 +31,13 @@ namespace :form_definition do
end
directories = ["config/forms", "spec/fixtures/forms"]
# directories = ["config/forms"]
get_all_form_paths(directories).each do |path|
puts path
file = File.open(path)
data = JSON.parse(file.read)
puts JSON::Validator.fully_validate(schema, data, :strict => true)
puts JSON::Validator.fully_validate(schema, data, strict: true)
begin
JSON::Validator.validate!(schema, data)
@ -47,4 +46,4 @@ namespace :form_definition do
end
end
end
end
end

Loading…
Cancel
Save