diff --git a/app/views/partners/show.html.erb b/app/views/partners/show.html.erb index e1280b31f6..2477a7e687 100644 --- a/app/views/partners/show.html.erb +++ b/app/views/partners/show.html.erb @@ -238,7 +238,7 @@ <% @partner_distributions.each do |dist| %> - <%= dist.created_at.strftime("%m/%d/%Y") %> + <%= dist.issued_at.strftime("%m/%d/%Y") %> <%= dist.storage_location.name %> <%= dist.line_items.total %> diff --git a/spec/requests/partners_requests_spec.rb b/spec/requests/partners_requests_spec.rb index 9084b6251d..52bb315b9f 100644 --- a/spec/requests/partners_requests_spec.rb +++ b/spec/requests/partners_requests_spec.rb @@ -87,7 +87,11 @@ response end - let(:partner) { create(:partner, organization: organization, status: :approved) } + let(:partner) do + partner = create(:partner, organization: organization, status: :approved) + partner.distributions << create(:distribution, :with_items, :past, item_quantity: 1231) + partner + end let!(:family1) { FactoryBot.create(:partners_family, guardian_zip_code: '45612-123', partner: partner) } let!(:family2) { FactoryBot.create(:partners_family, guardian_zip_code: '45612-126', partner: partner) } let!(:family3) { FactoryBot.create(:partners_family, guardian_zip_code: '45612-123', partner: partner) } @@ -107,6 +111,14 @@ context "html" do let(:response_format) { 'html' } + it "displays distribution scheduled date" do + subject + partner.distributions.each do |distribution| + expect(subject.body).to include(distribution.issued_at.strftime("%m/%d/%Y")) + expect(subject.body).to_not include(distribution.created_at.strftime("%m/%d/%Y")) + end + end + context "without org admin" do it 'should not show the manage users button' do expect(subject).to be_successful @@ -114,7 +126,7 @@ end end - context "without org admin" do + context "with org admin" do before(:each) do user.add_role(Role::ORG_ADMIN, organization) end