Skip to content

Commit

Permalink
Consolidate model spec in general test file
Browse files Browse the repository at this point in the history
Our validations are now largely defined by the schemas and are being applied
to the models without the need to be manually defined and configured.

This validation in tested by our feature tests. It seems unnecessary to test this validation twice.
  • Loading branch information
GDSNewt committed Feb 27, 2025
1 parent 9802a43 commit a4d70bd
Show file tree
Hide file tree
Showing 27 changed files with 28 additions and 472 deletions.
11 changes: 0 additions & 11 deletions spec/models/aaib_report_spec.rb

This file was deleted.

43 changes: 0 additions & 43 deletions spec/models/algorithmic_transparency_record_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/asylum_support_decision_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/business_finance_support_scheme_spec.rb

This file was deleted.

40 changes: 0 additions & 40 deletions spec/models/cma_case_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/countryside_stewardship_grant_spec.rb

This file was deleted.

26 changes: 0 additions & 26 deletions spec/models/data_ethics_guidance_document_spec.rb

This file was deleted.

28 changes: 28 additions & 0 deletions spec/models/document_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require "spec_helper"
require "models/valid_against_schema"

EXCEPTIONS_TO_GENERAL_TESTING = %w[
ai_assurance_portfolio_technique
animal_disease_case
drcf_digital_markets_research
export_health_certificate
traffic_commissioner_regulatory_decision
].freeze

Dir["lib/documents/schemas/*.json"].each do |file|
schema = JSON.parse(File.read(file))
format = schema["filter"]["format"]

next if EXCEPTIONS_TO_GENERAL_TESTING.include?(format)

RSpec.describe format.classify.constantize do
let(:payload) { FactoryBot.create(format.to_sym) }
include_examples "it saves payloads that are valid against the 'specialist_document' schema"

it "is not exportable" do
unless subject.instance_of?(BusinessFinanceSupportScheme)
expect(subject.class).not_to be_exportable
end
end
end
end
11 changes: 0 additions & 11 deletions spec/models/employment_appeal_tribunal_decision_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/employment_tribunal_decision_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/esi_fund_spec.rb

This file was deleted.

23 changes: 0 additions & 23 deletions spec/models/farming_grant_spec.rb

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/international_development_fund_spec.rb

This file was deleted.

34 changes: 0 additions & 34 deletions spec/models/life_saving_maritime_appliance_service_station_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/maib_report_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/marine_notice_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/medical_safety_alert_spec.rb

This file was deleted.

15 changes: 0 additions & 15 deletions spec/models/product_safety_alert_report_recall_spec.rb

This file was deleted.

27 changes: 0 additions & 27 deletions spec/models/protected_food_drink_name_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/models/raib_report_spec.rb

This file was deleted.

Loading

0 comments on commit a4d70bd

Please sign in to comment.