Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions app/models/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Form < ApplicationRecord
include FormStateMachine
extend Mobility

self.ignored_columns += [:language]
self.ignored_columns += %i[language submission_type submission_format send_daily_submission_batch send_weekly_submission_batch]

SUPPORTED_LANGUAGES = %w[en cy].freeze

Expand Down Expand Up @@ -32,26 +32,14 @@ class Form < ApplicationRecord
:what_happens_next_markdown,
:payment_url

enum :submission_type, {
email: "email",
s3: "s3",
}

enum :send_copy_of_answers, {
disabled: "disabled",
enabled: "enabled",
}, prefix: :send_copy_of_answers

# ActiveRecord doesn't support enums with arrays
# enum :submission_format, {
# csv: "csv",
# json: "json",
# }

validates :name, presence: true
validates :payment_url, url: true, allow_blank: true
validate :marking_complete_with_errors
validates :submission_type, presence: true
validates :send_copy_of_answers, presence: true
validates :available_languages, presence: true, inclusion: { in: SUPPORTED_LANGUAGES }
validates :submission_email, email_address: { message: :invalid_email }, allow_blank: true
Expand Down
4 changes: 0 additions & 4 deletions app/models/form_document/content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class FormDocument::Content
attribute :support_email, :string
attribute :support_phone, :string
attribute :s3_bucket_name, :string
attribute :submission_type, :string
attribute :submission_format, array: true
attribute :declaration_text, :string
attribute :declaration_markdown, :string
attribute :s3_bucket_region, :string
Expand All @@ -31,8 +29,6 @@ class FormDocument::Content
attribute :privacy_policy_url, :string
attribute :s3_bucket_aws_account_id, :string
attribute :what_happens_next_markdown, :string
attribute :send_daily_submission_batch, :boolean
attribute :send_weekly_submission_batch, :boolean
attribute :send_copy_of_answers, :string
attribute :delivery_configurations, array: true

Expand Down
2 changes: 0 additions & 2 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@
support_phone: "08000800",
what_happens_next_markdown: "Test",
share_preview_completed: true,
submission_type: "s3",
submission_format: %w[csv],
s3_bucket_region: "eu-west-2",
s3_bucket_name: "govuk-forms-submissions-to-s3-test",
s3_bucket_aws_account_id: "711966560482",
Expand Down
60 changes: 0 additions & 60 deletions lib/tasks/data_migrations.rake

This file was deleted.

4 changes: 0 additions & 4 deletions spec/factories/models/forms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
factory :form, class: "Form" do
sequence(:name) { |n| "Form #{n}" }
submission_email { Faker::Internet.email(domain: "example.gov.uk") }
submission_type { "email" }
submission_format { [] }
privacy_policy_url { Faker::Internet.url(host: "gov.uk") }
support_email { nil }
support_phone { nil }
Expand All @@ -18,8 +16,6 @@
state { :draft }
payment_url { nil }
external_id { nil }
send_daily_submission_batch { false }
send_weekly_submission_batch { false }
send_copy_of_answers { "disabled" }
brand_id { nil }
s3_bucket_aws_account_id { nil }
Expand Down
128 changes: 0 additions & 128 deletions spec/lib/tasks/data_migrations.rake_spec.rb

This file was deleted.

15 changes: 14 additions & 1 deletion spec/models/form_document/content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@
end

it "has all form attributes the original form has" do
expected_attributes = form.attributes.except(*%w[id state external_id pages question_section_completed declaration_section_completed share_preview_completed welsh_completed copied_from_id])
excluded_attributes = %w[id
state
external_id
pages
question_section_completed
declaration_section_completed
share_preview_completed
welsh_completed
copied_from_id
submission_type
submission_format
send_daily_submission_batch
send_weekly_submission_batch]
expected_attributes = form.attributes.except(*excluded_attributes)
expect(form_document_content).to have_attributes(expected_attributes)
end

Expand Down
40 changes: 0 additions & 40 deletions spec/models/form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,6 @@
expect(form).to be_valid
end
end

context "when there is no submission type" do
it "returns invalid" do
form.submission_type = nil
expect(form).to be_invalid
end
end
end
end

Expand Down Expand Up @@ -900,15 +893,6 @@
end
end

describe "submission type" do
describe "enum" do
it "returns a list of submission types" do
expect(described_class.submission_types.keys).to eq(%w[email s3])
expect(described_class.submission_types.values).to eq(%w[email s3])
end
end
end

describe "answer email copy" do
describe "enum" do
it "returns a list of email copy answers values" do
Expand All @@ -924,30 +908,6 @@
end
end

describe "submission format" do
let(:form) { create :form }

it "can be empty" do
form.update!(submission_format: [])
expect(form.submission_format).to be_empty
end

it "stores an array of strings" do
form.update!(submission_format: %w[csv json])
expect(form.submission_format).to include "csv"
expect(form.submission_format).to include "json"
end

# ActiveRecord doesn't support enums with arrays
# describe "enum" do
# it "returns a list of submission formats" do
# formats = %w[csv json]
# expect(described_class.submission_formats.keys).to eq formats
# expect(described_class.submission_formats.values).to eq formats
# end
# end
end

describe "#destroy" do
let(:form) { create :form }

Expand Down