diff --git a/app/components/providers/provider_list/view.html.erb b/app/components/providers/provider_list/view.html.erb
index bae50c979a..12c5e9cac1 100644
--- a/app/components/providers/provider_list/view.html.erb
+++ b/app/components/providers/provider_list/view.html.erb
@@ -25,8 +25,8 @@
if @provider.accredited_provider?
component.with_row do |row|
- row.with_key { "Accredited provider ID" }
- row.with_value { value_provided?(@provider.accredited_provider_id.to_s) }
+ row.with_key { "Accredited provider Number" }
+ row.with_value { value_provided?(@provider.accredited_provider_number.to_s) }
row.with_action(text: "Change", href: edit_support_recruitment_cycle_provider_path(@provider.recruitment_cycle_year, @provider), visually_hidden_text: "accredited provider id")
end
end
diff --git a/app/controllers/support/providers_controller.rb b/app/controllers/support/providers_controller.rb
index 707921e64a..8a3031d9d2 100644
--- a/app/controllers/support/providers_controller.rb
+++ b/app/controllers/support/providers_controller.rb
@@ -52,7 +52,7 @@ def update_provider_params
:provider_type,
:ukprn,
:urn,
- :accrediting_provider, :accredited_provider_id)
+ :accrediting_provider, :accredited_provider_number)
end
def create_provider_params
diff --git a/app/forms/support/provider_form.rb b/app/forms/support/provider_form.rb
index d1eaca183d..6fe487bdf1 100644
--- a/app/forms/support/provider_form.rb
+++ b/app/forms/support/provider_form.rb
@@ -4,7 +4,7 @@ module Support
class ProviderForm < BaseForm
FIELDS = %i[
accredited_provider
- accredited_provider_id
+ accredited_provider_number
provider_code
provider_name
@@ -14,9 +14,9 @@ class ProviderForm < BaseForm
urn
].freeze
- UNIVERSITY_ACCREDITED_PROVIDER_ID_FORMAT = /\A1\d{3}\z/
- SCITT_ACCREDITED_PROVIDER_ID_FORMAT = /\A5\d{3}\z/
- ACCREDITED_PROVIDER_ID_FORMAT = /\A[15]\d{3}\z/
+ UNIVERSITY_ACCREDITED_PROVIDER_NUMBER_FORMAT = /\A1\d{3}\z/
+ SCITT_ACCREDITED_PROVIDER_NUMBER_FORMAT = /\A5\d{3}\z/
+ ACCREDITED_PROVIDER_NUMBER_FORMAT = /\A[15]\d{3}\z/
attr_accessor(*FIELDS, :recruitment_cycle)
@@ -32,7 +32,7 @@ def initialize(identifier_model, recruitment_cycle:, params: {})
validate :provider_code_taken
validates :accredited_provider, presence: true
- validate :validate_accredited_provider_id
+ validate :validate_accredited_provider_number
validates :ukprn, ukprn_format: { allow_blank: false }
@@ -77,21 +77,21 @@ def provider_type_school_is_an_invalid_accredited_provider
errors.add(:provider_type, :school_is_an_invalid_accredited_provider) if accredited_provider? && lead_school?
end
- def validate_accredited_provider_id
+ def validate_accredited_provider_number
return unless accredited_provider?
- if accredited_provider_id.blank?
- errors.add(:accredited_provider_id, :blank)
+ if accredited_provider_number.blank?
+ errors.add(:accredited_provider_number, :blank)
else
regex = if university?
- UNIVERSITY_ACCREDITED_PROVIDER_ID_FORMAT
+ UNIVERSITY_ACCREDITED_PROVIDER_NUMBER_FORMAT
elsif scitt?
- SCITT_ACCREDITED_PROVIDER_ID_FORMAT
+ SCITT_ACCREDITED_PROVIDER_NUMBER_FORMAT
else
- ACCREDITED_PROVIDER_ID_FORMAT
+ ACCREDITED_PROVIDER_NUMBER_FORMAT
end
- errors.add(:accredited_provider_id, :invalid) unless regex.match?(accredited_provider_id)
+ errors.add(:accredited_provider_number, :invalid) unless regex.match?(accredited_provider_number)
end
end
end
diff --git a/app/models/provider.rb b/app/models/provider.rb
index ed04f87a90..ffe1b0ee89 100644
--- a/app/models/provider.rb
+++ b/app/models/provider.rb
@@ -168,7 +168,7 @@ def current_accredited_courses
validate :add_enrichment_errors
- validates :accredited_provider_id, accredited_provider_id_format: { allow_blank: true }, on: :update, if: :accredited_provider?
+ validates :accredited_provider_number, accredited_provider_number_format: { allow_blank: true }, on: :update, if: :accredited_provider?
acts_as_mappable lat_column_name: :latitude, lng_column_name: :longitude
diff --git a/app/validators/accredited_provider_id_format_validator.rb b/app/validators/accredited_provider_number_format_validator.rb
similarity index 85%
rename from app/validators/accredited_provider_id_format_validator.rb
rename to app/validators/accredited_provider_number_format_validator.rb
index 76322aac51..126c7c7a1f 100644
--- a/app/validators/accredited_provider_id_format_validator.rb
+++ b/app/validators/accredited_provider_number_format_validator.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AccreditedProviderIdFormatValidator < ActiveModel::EachValidator
+class AccreditedProviderNumberFormatValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if options[:allow_blank] && value.blank?
diff --git a/app/views/support/providers/_list.html.erb b/app/views/support/providers/_list.html.erb
index b6f2d68e73..567492455b 100644
--- a/app/views/support/providers/_list.html.erb
+++ b/app/views/support/providers/_list.html.erb
@@ -27,8 +27,8 @@
<% if provider.accrediting_provider_before_type_cast == "Y" %>
- <% if provider.accredited_provider_id.present? %>
- <%= govuk_tag(text: provider.accredited_provider_id, colour: "green") %>
+ <% if provider.accredited_provider_number.present? %>
+ <%= govuk_tag(text: provider.accredited_provider_number, colour: "green") %>
<% else %>
<%= govuk_tag(text: "Fill me in", colour: "yellow") %>
<% end %>
diff --git a/app/views/support/providers/edit.html.erb b/app/views/support/providers/edit.html.erb
index 299948f160..cb83ff9fa5 100644
--- a/app/views/support/providers/edit.html.erb
+++ b/app/views/support/providers/edit.html.erb
@@ -35,8 +35,8 @@
<%= f.govuk_radio_buttons_fieldset :accrediting_provider, legend: { text: "Is the organisation an accredited provider?", size: "s" } do %>
<%= f.govuk_radio_button :accrediting_provider, :accredited_provider, label: { text: "Yes", size: "s" } do %>
- <%= f.govuk_text_field :accredited_provider_id,
- label: { text: "Accredited provider ID" },
+ <%= f.govuk_text_field :accredited_provider_number,
+ label: { text: "Accredited provider Number" },
width: 10 %>
<% end %>
<%= f.govuk_radio_button :accrediting_provider, :not_an_accredited_provider, label: { text: "No", size: "s" } %>
diff --git a/app/views/support/providers/onboarding/checks/show.html.erb b/app/views/support/providers/onboarding/checks/show.html.erb
index 66ef882c76..f6d12c3b82 100644
--- a/app/views/support/providers/onboarding/checks/show.html.erb
+++ b/app/views/support/providers/onboarding/checks/show.html.erb
@@ -37,9 +37,9 @@
if @provider_form.accredited_provider?
component.with_row do |row|
- row.with_key { "Accredited provider ID" }
- row.with_value { @provider_form.accredited_provider_id }
- row.with_action(text: "Change", href: new_support_recruitment_cycle_providers_onboarding_path(goto_confirmation: true), visually_hidden_text: "accredited provider ID")
+ row.with_key { "Accredited provider Number" }
+ row.with_value { @provider_form.accredited_provider_number }
+ row.with_action(text: "Change", href: new_support_recruitment_cycle_providers_onboarding_path(goto_confirmation: true), visually_hidden_text: "accredited provider Number")
end
end
diff --git a/app/views/support/providers/onboardings/new.html.erb b/app/views/support/providers/onboardings/new.html.erb
index b85bcbcfc7..cb8dcba4c7 100644
--- a/app/views/support/providers/onboardings/new.html.erb
+++ b/app/views/support/providers/onboardings/new.html.erb
@@ -25,9 +25,9 @@
<%= f.govuk_radio_buttons_fieldset(:accredited_provider, legend: { text: "Is the organisation an accredited provider?", size: "s" }) do %>
<%= f.govuk_radio_button :accredited_provider, :accredited_provider, label: { text: "Yes" }, link_errors: true do %>
- <%= f.govuk_text_field :accredited_provider_id,
+ <%= f.govuk_text_field :accredited_provider_number,
width: 10,
- label: { text: "Accredited provider ID" },
+ label: { text: "Accredited provider Number" },
autocomplete: :disabled %>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 4e7f8d1047..ea316f6bdb 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -901,9 +901,9 @@ en:
ukprn:
blank: Enter a UK provider reference number (UKPRN)
contains_eight_numbers_starting_with_one: Enter a valid UK provider reference number (UKPRN) - it must be 8 digits starting with a 1, like 12345678
- accredited_provider_id:
- blank: Enter the accredited provider ID
- format: Enter a valid accredited provider ID - it must be 4 digits starting with a 1 or a 5
+ accredited_provider_number:
+ blank: Enter the accredited provider Number
+ format: Enter a valid accredited provider Number - it must be 4 digits starting with a 1 or a 5
organisation:
attributes:
name:
@@ -1092,9 +1092,9 @@ en:
provider_type:
blank: "Select a provider type"
school_is_an_invalid_accredited_provider: "Accredited provider cannot be a school"
- accredited_provider_id:
- blank: "Enter an accredited provider ID"
- invalid: "Enter a valid accredited provider ID"
+ accredited_provider_number:
+ blank: "Enter an accredited provider Number"
+ invalid: "Enter a valid accredited provider Number"
urn:
blank: "Enter a unique reference number (URN)"
invalid: "Enter a valid unique reference number (URN)"
diff --git a/spec/factories/providers.rb b/spec/factories/providers.rb
index 2727322b03..bdb69ac522 100644
--- a/spec/factories/providers.rb
+++ b/spec/factories/providers.rb
@@ -56,7 +56,7 @@
trait :accredited_provider do
provider_type { :university }
accrediting_provider { 'Y' }
- accredited_provider_id { Faker::Number.within(range: 1000..1999) }
+ accredited_provider_number { Faker::Number.within(range: 1000..1999) }
urn { nil }
end
diff --git a/spec/features/support/providers/editing_a_provider_spec.rb b/spec/features/support/providers/editing_a_provider_spec.rb
index eb748656bf..37a2f59702 100644
--- a/spec/features/support/providers/editing_a_provider_spec.rb
+++ b/spec/features/support/providers/editing_a_provider_spec.rb
@@ -18,7 +18,7 @@
then_i_am_on_the_support_provider_edit_page
when_i_fill_in_a_valid_provider_name
and_i_choose_a_different_provider_type
- and_i_fill_in_a_valid_id
+ and_i_fill_in_a_valid_number
and_i_click_the_submit_button
then_i_am_redirected_back_to_the_support_provider_show_page
and_the_provider_details_are_updated
@@ -55,7 +55,7 @@
private
def and_there_is_a_provider
- @provider = create(:provider, :accredited_provider, :scitt, provider_name: 'Provider 1', accredited_provider_id: 5432)
+ @provider = create(:provider, :accredited_provider, :scitt, provider_name: 'Provider 1', accredited_provider_number: 5432)
end
def when_i_visit_the_support_provider_show_page
@@ -96,8 +96,8 @@ def when_i_fill_in_a_valid_provider_name
support_provider_edit_page.provider_name.set('Provider 2')
end
- def and_i_fill_in_a_valid_id
- fill_in 'provider-accredited-provider-id-field', with: '1234'
+ def and_i_fill_in_a_valid_number
+ fill_in 'provider-accredited-provider-number-field', with: '1234'
end
def and_i_choose_a_different_provider_type
diff --git a/spec/features/support/providers/onboarding_a_new_provider_spec.rb b/spec/features/support/providers/onboarding_a_new_provider_spec.rb
index 8d10b16797..8926a1c3b0 100644
--- a/spec/features/support/providers/onboarding_a_new_provider_spec.rb
+++ b/spec/features/support/providers/onboarding_a_new_provider_spec.rb
@@ -159,12 +159,12 @@ def when_i_fill_in_a_valid_provider_details(provider_type:)
fill_in 'Unique reference number (URN)', with: '54321'
when :university
choose 'Yes'
- fill_in 'Accredited provider ID', with: '1111'
+ fill_in 'Accredited provider Number', with: '1111'
choose 'Higher education institution (HEI)'
when :scitt
choose 'Yes'
- fill_in 'Accredited provider ID', with: '5555'
+ fill_in 'Accredited provider Number', with: '5555'
choose 'School centred initial teacher training (SCITT)'
end
@@ -192,12 +192,12 @@ def and_the_provider_form_should_be_prefilled_with_the_provider_details(provider
expect(page).to have_field('Unique reference number (URN)', with: '54321')
when :university
expect(page).to have_checked_field('Yes')
- expect(page).to have_field('Accredited provider ID', with: '1111')
+ expect(page).to have_field('Accredited provider Number', with: '1111')
expect(page).to have_checked_field('Higher education institution (HEI)')
when :scitt
expect(page).to have_checked_field('Yes')
- expect(page).to have_field('Accredited provider ID', with: '5555')
+ expect(page).to have_field('Accredited provider Number', with: '5555')
expect(page).to have_checked_field('School centred initial teacher training (SCITT)')
end
diff --git a/spec/forms/support/provider_form_spec.rb b/spec/forms/support/provider_form_spec.rb
index 6469e6b037..09359b977c 100644
--- a/spec/forms/support/provider_form_spec.rb
+++ b/spec/forms/support/provider_form_spec.rb
@@ -12,7 +12,7 @@ module Support
let(:params) do
build(:provider).attributes.symbolize_keys.slice(
:accrediting_provider,
- :accredited_provider_id,
+ :accredited_provider_number,
:provider_code,
:provider_name,
:provider_type,
@@ -127,7 +127,7 @@ module Support
{ accredited_provider: :accredited_provider }
end
- include_examples 'blank validation', :accredited_provider_id, 'Enter an accredited provider ID'
+ include_examples 'blank validation', :accredited_provider_number, 'Enter an accredited provider Number'
end
context 'urn set to invalid' do
@@ -190,42 +190,42 @@ module Support
end
end
- shared_examples 'accredited provider id validation' do |provider_type, accredited_provider_id, message|
- context "provider_type is set to '#{provider_type}' and accredited_provider_id is set to '#{accredited_provider_id}'" do
+ shared_examples 'accredited provider number validation' do |provider_type, accredited_provider_number, message|
+ context "provider_type is set to '#{provider_type}' and accredited_provider_number is set to '#{accredited_provider_number}'" do
let(:params) do
{
provider_type:,
accredited_provider: :accredited_provider,
- accredited_provider_id:
+ accredited_provider_number:
}
end
- it 'validates the accredited provider id' do
+ it 'validates the accredited provider number' do
expect(subject).not_to be_valid
- expect(subject.errors[:accredited_provider_id]).to match_array(message)
+ expect(subject.errors[:accredited_provider_number]).to match_array(message)
end
end
end
- blank_accredited_provider_id_message = 'Enter an accredited provider ID'
+ blank_accredited_provider_number_message = 'Enter an accredited provider Number'
- [nil, ''].each do |blank_accredited_provider_id|
- include_examples 'accredited provider id validation', nil, blank_accredited_provider_id, blank_accredited_provider_id_message
- include_examples 'accredited provider id validation', :scitt, blank_accredited_provider_id, blank_accredited_provider_id_message
- include_examples 'accredited provider id validation', :university, blank_accredited_provider_id, blank_accredited_provider_id_message
+ [nil, ''].each do |blank_accredited_provider_number|
+ include_examples 'accredited provider number validation', nil, blank_accredited_provider_number, blank_accredited_provider_number_message
+ include_examples 'accredited provider number validation', :scitt, blank_accredited_provider_number, blank_accredited_provider_number_message
+ include_examples 'accredited provider number validation', :university, blank_accredited_provider_number, blank_accredited_provider_number_message
end
- invalid_accredited_provider_id_message = 'Enter a valid accredited provider ID'
+ invalid_accredited_provider_number_message = 'Enter a valid accredited provider Number'
- %w[a aaaa 12345 54321 abcde 1 5].each do |invalid_accredited_provider_id|
- include_examples 'accredited provider id validation', nil, invalid_accredited_provider_id, invalid_accredited_provider_id_message
- include_examples 'accredited provider id validation', :scitt, invalid_accredited_provider_id, invalid_accredited_provider_id_message
- include_examples 'accredited provider id validation', :university, invalid_accredited_provider_id, invalid_accredited_provider_id_message
+ %w[a aaaa 12345 54321 abcde 1 5].each do |invalid_accredited_provider_number|
+ include_examples 'accredited provider number validation', nil, invalid_accredited_provider_number, invalid_accredited_provider_number_message
+ include_examples 'accredited provider number validation', :scitt, invalid_accredited_provider_number, invalid_accredited_provider_number_message
+ include_examples 'accredited provider number validation', :university, invalid_accredited_provider_number, invalid_accredited_provider_number_message
end
- include_examples 'accredited provider id validation', :scitt, '1234', invalid_accredited_provider_id_message
- include_examples 'accredited provider id validation', :university, '5432', invalid_accredited_provider_id_message
+ include_examples 'accredited provider number validation', :scitt, '1234', invalid_accredited_provider_number_message
+ include_examples 'accredited provider number validation', :university, '5432', invalid_accredited_provider_number_message
end
describe '#stash' do
diff --git a/spec/validators/accredited_provider_id_format_validator_spec.rb b/spec/validators/accredited_provider_number_format_validator_spec.rb
similarity index 75%
rename from spec/validators/accredited_provider_id_format_validator_spec.rb
rename to spec/validators/accredited_provider_number_format_validator_spec.rb
index 59e6e98eda..3985e68c35 100644
--- a/spec/validators/accredited_provider_id_format_validator_spec.rb
+++ b/spec/validators/accredited_provider_number_format_validator_spec.rb
@@ -2,21 +2,21 @@
require 'rails_helper'
-class AccreditedProviderIdFormatValidatorTest
+class AccreditedProviderNumberFormatValidatorTest
include ActiveModel::Validations
- attr_accessor :accredited_provider_id
+ attr_accessor :accredited_provider_number
- validates :accredited_provider_id, accredited_provider_id_format: { allow_blank: false }
+ validates :accredited_provider_number, accredited_provider_number_format: { allow_blank: false }
end
-describe AccreditedProviderIdFormatValidator do
+describe AccreditedProviderNumberFormatValidator do
let(:accredited_provider) { create(:provider, :accredited_provider, :university) }
- let(:accredited_provider_id) { 1234 }
+ let(:accredited_provider_number) { 1234 }
let(:model) do
model = accredited_provider
- model.accredited_provider_id = accredited_provider_id
+ model.accredited_provider_number = accredited_provider_number
model
end
@@ -28,7 +28,7 @@ class AccreditedProviderIdFormatValidatorTest
end
context 'with a valid id starting with 5' do
- let(:accredited_provider_id) { 5432 }
+ let(:accredited_provider_number) { 5432 }
it 'does not add an error' do
expect(model).not_to be_valid
@@ -46,7 +46,7 @@ class AccreditedProviderIdFormatValidatorTest
end
context 'with a valid id starting with 5' do
- let(:accredited_provider_id) { 5432 }
+ let(:accredited_provider_number) { 5432 }
it 'does not add an error' do
expect(model).to be_valid
@@ -65,7 +65,7 @@ class AccreditedProviderIdFormatValidatorTest
end
context 'with a valid id starting with 5' do
- let(:accredited_provider_id) { 5432 }
+ let(:accredited_provider_number) { 5432 }
it 'adds provider_type error' do
model.valid?
|