Skip to content

Commit 44f12db

Browse files
committed
Fix intake storage location
1 parent 9424917 commit 44f12db

5 files changed

Lines changed: 28 additions & 1 deletion

File tree

app/controllers/admin/organizations_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def show
6969
@organization = Organization.find(params[:id])
7070
@header_link = admin_dashboard_path
7171
@default_storage_location = StorageLocation.find_by(id: @organization.default_storage_location) if @organization.default_storage_location
72+
@intake_storage_location = StorageLocation.find_by(id: @organization.storage_locations) if @organization.intake_location
7273
@users = @organization.users.with_discarded.includes(:roles, :organization).alphabetized
7374
end
7475

app/controllers/organizations_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def show
77
@organization = current_organization
88
@header_link = dashboard_path
99
@default_storage_location = StorageLocation.find_by(id: @organization.default_storage_location) if @organization.default_storage_location
10+
@intake_storage_location = StorageLocation.find_by(id: @organization.intake_location) if @organization.intake_location
1011
@users = @organization.users.with_discarded.includes(:roles, :organization).alphabetized
1112
end
1213

app/views/organizations/_details.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<h3 class='font-bold'>Default Intake Location</h3>
8181
<p>
8282
<%= fa_icon "building" %>
83-
<%= @default_storage_location&.name || "Not defined" %>
83+
<%= @intake_storage_location&.name || "Not defined" %>
8484
</p>
8585
</div>
8686
<div class="mb-4">

spec/requests/admin/organizations_requests_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,18 @@
166166
expect(response).to be_successful
167167
end
168168

169+
it "displays the correct organization details" do
170+
intake_storage_location = create(:storage_location, organization:, name: "Intake Center")
171+
default_storage_location = create(:storage_location, organization:, name: "Default Center")
172+
173+
organization.update!(intake_location: intake_storage_location.id, default_storage_location: default_storage_location.id)
174+
175+
get admin_organization_path({ id: organization.id })
176+
177+
expect(response.body).to include("Intake Center")
178+
expect(response.body).to include("Default Center")
179+
end
180+
169181
context "with an organization user" do
170182
let!(:user) { create(:user, organization: organization) }
171183

spec/requests/organization_requests_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@
4747
expect(html.text).to include("Receive email when partner makes a request:")
4848
end
4949

50+
it "displays the correct organization details" do
51+
intake_storage_location = create(:storage_location, organization:, name: "Intake Center")
52+
default_storage_location = create(:storage_location, organization:, name: "Default Center")
53+
54+
organization.update!(intake_location: intake_storage_location.id, default_storage_location: default_storage_location.id)
55+
56+
get organization_path
57+
58+
html = Nokogiri::HTML(response.body)
59+
expect(html.text).to include("Intake Center")
60+
expect(html.text).to include("Default Center")
61+
end
62+
5063
context "when enable_packs flipper is on" do
5164
it "displays organization's custom units" do
5265
Flipper.enable(:enable_packs)

0 commit comments

Comments
 (0)