Skip to content

Commit afaf756

Browse files
Add creator accepts safeguarding responsiblities to school create (#537)
Part of this work RaspberryPiFoundation/editor-standalone#548
1 parent 6266ba8 commit afaf756

File tree

8 files changed

+20
-4
lines changed

8 files changed

+20
-4
lines changed

app/controllers/api/schools_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def school_params
6464
:creator_department,
6565
:creator_agree_authority,
6666
:creator_agree_terms_and_conditions,
67-
:creator_agree_to_ux_contact
67+
:creator_agree_to_ux_contact,
68+
:creator_agree_responsible_safeguarding
6869
)
6970
end
7071
end

app/models/school.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class School < ApplicationRecord
1818
validates :creator_id, presence: true, uniqueness: true
1919
validates :creator_agree_authority, presence: true, acceptance: true
2020
validates :creator_agree_terms_and_conditions, presence: true, acceptance: true
21+
validates :creator_agree_responsible_safeguarding, presence: true, acceptance: true
2122
validates :rejected_at, absence: { if: proc { |school| school.verified? } }
2223
validates :verified_at, absence: { if: proc { |school| school.rejected? } }
2324
validates :code,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddCreatorAcceptsSafeguardingResponsibilities < ActiveRecord::Migration[7.1]
2+
def change
3+
add_column :schools, :creator_agree_responsible_safeguarding, :boolean, default: true
4+
end
5+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/concepts/school/create_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
country_code: 'GB',
1313
creator_agree_authority: true,
1414
creator_agree_terms_and_conditions: true,
15-
creator_agree_to_ux_contact: true
15+
creator_agree_to_ux_contact: true,
16+
creator_agree_responsible_safeguarding: true
1617
}
1718
end
1819

spec/factories/school.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
creator_id { SecureRandom.uuid }
1111
creator_agree_authority { true }
1212
creator_agree_terms_and_conditions { true }
13+
creator_agree_responsible_safeguarding { true }
1314
end
1415

1516
factory :verified_school, parent: :school do

spec/features/school/creating_a_school_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
country_code: 'GB',
2222
creator_agree_authority: true,
2323
creator_agree_terms_and_conditions: true,
24-
creator_agree_to_ux_contact: true
24+
creator_agree_to_ux_contact: true,
25+
creator_agree_responsible_safeguarding: true
2526
}
2627
}
2728
end

spec/models/school_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@
187187
expect(school).to be_invalid
188188
end
189189

190+
it 'requires creator_agree_responsible_safeguarding to be true' do
191+
school.creator_agree_responsible_safeguarding = false
192+
expect(school).to be_invalid
193+
end
194+
190195
it 'does not require creator_agree_to_ux_contact to be true' do
191196
school.creator_agree_to_ux_contact = false
192197
expect(school).to be_valid

0 commit comments

Comments
 (0)