diff --git a/app/controllers/distributions_controller.rb b/app/controllers/distributions_controller.rb index ffc3711da6..3aa9198dcc 100644 --- a/app/controllers/distributions_controller.rb +++ b/app/controllers/distributions_controller.rb @@ -205,6 +205,7 @@ def update @distribution.line_items.build if @distribution.line_items.size.zero? @distribution.initialize_request_items @items = current_organization.items.alphabetized + @partner_list = current_organization.partners.alphabetized @storage_locations = current_organization.storage_locations.active_locations.alphabetized render :edit end diff --git a/spec/requests/distributions_requests_spec.rb b/spec/requests/distributions_requests_spec.rb index 03b1b919ab..dff2d11976 100644 --- a/spec/requests/distributions_requests_spec.rb +++ b/spec/requests/distributions_requests_spec.rb @@ -478,9 +478,10 @@ include_examples "requiring authorization" end - describe "POST #update" do + describe "PATCH #update" do + let(:partner_name) { "Patrick" } let(:location) { create(:storage_location, organization: organization) } - let(:partner) { create(:partner, organization: organization) } + let(:partner) { create(:partner, name: partner_name, organization: organization) } let(:distribution) { create(:distribution, partner: partner, organization: organization) } let(:issued_at) { distribution.issued_at } @@ -518,6 +519,15 @@ expect(flash[:error]).to include("Distribution date and time can't be blank") expect(response).not_to redirect_to(anything) end + + it "renders storage location dropdowns" do + patch distribution_path(distribution_params) + + page = Nokogiri::HTML(response.body) + selectable_partners = page.at_css("select#distribution_partner_id").text.split("\n") + + expect(selectable_partners).to include("Patrick") + end end describe "when changing storage location" do