Skip to content

Commit

Permalink
Fix partner view to display distribution scheduled date (#4860)
Browse files Browse the repository at this point in the history
* fix partner view to display distribution scheduled date, not date of entry

* use request spec instead of system spec to verify date displayed
  • Loading branch information
McEileen authored Jan 7, 2025
1 parent 4d80126 commit e0bb165
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/views/partners/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
<tbody>
<% @partner_distributions.each do |dist| %>
<tr>
<td><%= dist.created_at.strftime("%m/%d/%Y") %></td>
<td><%= dist.issued_at.strftime("%m/%d/%Y") %></td>
<td><%= dist.storage_location.name %></td>
<td><%= dist.line_items.total %></td>
<td class="text-right">
Expand Down
16 changes: 14 additions & 2 deletions spec/requests/partners_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand All @@ -107,14 +111,22 @@
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
expect(subject.body).not_to include("Manage Users")
end
end

context "without org admin" do
context "with org admin" do
before(:each) do
user.add_role(Role::ORG_ADMIN, organization)
end
Expand Down

0 comments on commit e0bb165

Please sign in to comment.