-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove email_address from provider model
- Loading branch information
1 parent
763c0cc
commit afe172d
Showing
34 changed files
with
126 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,3 +266,4 @@ shared: | |
- provider_id | ||
- created_at | ||
- updated_at | ||
- primary |
5 changes: 5 additions & 0 deletions
5
db/migrate/20250115130956_remove_email_address_from_providers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class RemoveEmailAddressFromProviders < ActiveRecord::Migration[7.2] | ||
def change | ||
safety_assured { remove_column :providers, :email_address, :string } | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
db/migrate/20250115172549_add_primary_to_provider_email_addresses.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddPrimaryToProviderEmailAddresses < ActiveRecord::Migration[7.2] | ||
disable_ddl_transaction! | ||
|
||
def change | ||
add_column :provider_email_addresses, :primary, :boolean, default: false | ||
add_index :provider_email_addresses, :primary, algorithm: :concurrently | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
db/migrate/20250116091921_assign_primary_true_to_existing_provider_email_addresses.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class AssignPrimaryTrueToExistingProviderEmailAddresses < ActiveRecord::Migration[7.2] | ||
def up | ||
ProviderEmailAddress.update_all(primary: true) | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
describe "#sampling_checks_required" do | ||
subject(:sampling_checks_required_email) { described_class.sampling_checks_required(provider_sampling) } | ||
|
||
let(:provider) { build(:claims_provider, email_address: "[email protected]") } | ||
let(:provider) { create(:claims_provider) } | ||
let(:provider_sampling) { create(:provider_sampling, provider:) } | ||
let(:url_for_csv) { "https://example.com" } | ||
let(:service_name) { "Claim funding for mentor training" } | ||
|
@@ -15,7 +15,7 @@ | |
end | ||
|
||
it "sends the sampling checks required email" do | ||
expect(sampling_checks_required_email.to).to contain_exactly(provider.email_address) | ||
expect(sampling_checks_required_email.to).to match_array(provider.email_addresses) | ||
expect(sampling_checks_required_email.subject).to eq("ITT mentor claims need to be assured") | ||
expect(sampling_checks_required_email.body.to_s.squish).to eq(<<~EMAIL.squish) | ||
Dear #{provider.name}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,7 @@ | |
described_class.partnership_created_notification(user, source_organisation, partner_organisation) | ||
end | ||
|
||
let(:source_organisation) { create(:placements_provider, name: "Provider 1", email_address: "[email protected]") } | ||
let(:source_organisation) { create(:placements_provider, name: "Provider 1") } | ||
let(:partner_organisation) { create(:placements_school, name: "School 1") } | ||
let(:user) { create(:placements_user, schools: [partner_organisation]) } | ||
|
||
|
@@ -109,7 +109,7 @@ | |
## What happens next? | ||
You can now assign them to your placements. | ||
Contact the provider on [#{source_organisation.email_address}](mailto:#{source_organisation.email_address}) if you have any questions. | ||
Contact the provider on [#{source_organisation.email_addresses.first}](mailto:#{source_organisation.email_addresses.first}) if you have any questions. | ||
## Your account | ||
[Sign in to Manage school placements](http://placements.localhost/sign-in) | ||
|
@@ -124,7 +124,7 @@ | |
described_class.partnership_destroyed_notification(user, source_organisation, partner_organisation) | ||
end | ||
|
||
let(:source_organisation) { create(:placements_provider, name: "Provider 1", email_address: "[email protected]") } | ||
let(:source_organisation) { create(:placements_provider, name: "Provider 1") } | ||
let(:partner_organisation) { create(:placements_school, name: "School 1") } | ||
|
||
let(:user) { create(:placements_user, schools: [partner_organisation]) } | ||
|
@@ -143,7 +143,7 @@ | |
## What happens next? | ||
You will no longer be able to assign placements to this provider unless they add you again or you add them to your list of providers. | ||
If you think this is a mistake, contact them on [#{source_organisation.email_address}](mailto:#{source_organisation.email_address}). | ||
If you think this is a mistake, contact them on [#{source_organisation.email_addresses.first}](mailto:#{source_organisation.email_addresses.first}). | ||
## Your account | ||
[Sign in to Manage school placements](http://placements.localhost/sign-in) | ||
|
@@ -171,7 +171,7 @@ | |
- [#{placement.decorate.title}](http://placements.localhost/schools/#{partner_organisation.id}/placements/#{placement.id}) | ||
We recommend you speak to the provider to avoid confusion about placing trainees at your school. Contact them on [#{source_organisation.email_address}](mailto:#{source_organisation.email_address}). | ||
We recommend you speak to the provider to avoid confusion about placing trainees at your school. Contact them on [#{source_organisation.email_addresses.first}](mailto:#{source_organisation.email_addresses.first}). | ||
## Your account | ||
[Sign in to Manage school placements](http://placements.localhost/sign-in) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,4 +222,24 @@ | |
expect(school.primary?).to be(false) | ||
end | ||
end | ||
|
||
describe "#email_addresses" do | ||
subject(:email_addresses) { school.email_addresses } | ||
|
||
context "when the school does not have an email address" do | ||
let(:school) { create(:school) } | ||
|
||
it "returns an empty array" do | ||
expect(email_addresses).to eq([]) | ||
end | ||
end | ||
|
||
context "when the school does have an email address" do | ||
let(:school) { create(:school, email_address: "[email protected]") } | ||
|
||
it "returns an array containing the school's email address" do | ||
expect(email_addresses).to contain_exactly("[email protected]") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.