Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB

3 years ago
require "rails_helper"
require "rake"
RSpec.describe "form_definition" do
describe ":validate_all", type: :task do
subject(:task) { Rake::Task["form_definition:validate_all"] }
3 years ago
before do
Rake.application.rake_require("tasks/form_definition")
Rake::Task.define_task(:environment)
task.reenable
end
3 years ago
it "runs the validate task for each form definition in the project" do
expect(Rake::Task["form_definition:validate"]).to receive(:invoke).exactly(4).times
task.invoke
end
3 years ago
end
describe ":validate", type: :task do
subject(:task) { Rake::Task["form_definition:validate"] }
3 years ago
before do
Rake.application.rake_require("tasks/form_definition")
Rake::Task.define_task(:environment)
allow(JSON::Validator).to receive(:validate).and_return(true)
task.reenable
end
3 years ago
it "runs the validate task for the given form definition" do
expect(JSON::Validator).to receive(:validate!).at_least(1).time
task.invoke("config/forms/2021_2022.json")
end
3 years ago
end
end