-
Notifications
You must be signed in to change notification settings - Fork 13
GYR1-808 Allow multiple partners to serve clients in the same zip code #6110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| class RemoveZipcodeIndexingToPartner < ActiveRecord::Migration[7.1] | ||
| disable_ddl_transaction! | ||
|
|
||
| def up | ||
| remove_index :vita_partner_zip_codes, :zip_code | ||
| add_index :vita_partner_zip_codes, :zip_code, algorithm: :concurrently | ||
| end | ||
|
|
||
| def down | ||
| remove_index :vita_partner_zip_codes, :zip_code | ||
| add_index :vita_partner_zip_codes, :zip_code, unique: true, algorithm: :concurrently | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,16 +41,39 @@ | |
| end | ||
| end | ||
|
|
||
| context "when the code already exists" do | ||
| context "when the code already exists for a different partner" do | ||
| before do | ||
| create :vita_partner_zip_code, zip_code: zip_code, vita_partner: create(:organization) | ||
| end | ||
|
|
||
| it "does not make a new source parameter" do | ||
| it "creates a new vita partner zip code for this partner" do | ||
| expect { | ||
| post :create, params: params, format: :js, xhr: true | ||
| }.to change(vita_partner.serviced_zip_codes, :count).by 1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. had to look this up because i copied it from the rest of existing tests, but I think its to retrieve data from a URL without a fill page refresh |
||
| end | ||
|
|
||
| it "increases the total count of VitaPartnerZipCodes" do | ||
| expect { | ||
| post :create, params: params, format: :js, xhr: true | ||
| }.to change(VitaPartnerZipCode, :count).by 1 | ||
| end | ||
| end | ||
|
|
||
| context "when the code already exists for the same partner" do | ||
| before do | ||
| create :vita_partner_zip_code, zip_code: zip_code, vita_partner: vita_partner | ||
| end | ||
|
|
||
| it "does not create a duplicate zip code for the same partner" do | ||
| expect { | ||
| post :create, params: params, format: :js, xhr: true | ||
| }.not_to change(VitaPartnerZipCode, :count) | ||
| end | ||
|
|
||
| it "shows an error" do | ||
| post :create, params: params, format: :js, xhr: true | ||
| expect(flash.now[:alert]).to be_present | ||
| end | ||
| end | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,9 @@ | |
|
|
||
| expect(page).to have_text "All Clients" | ||
|
|
||
| expect(page).to have_css('.client-table') | ||
| expect(page).to have_css('.client-row', count: 4) | ||
|
|
||
| # Default sort order | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was a flaky test, added a wait condition to help things load first before checking the content |
||
| expected_rows = [ | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed to take out unique constraint