diff --git a/app/views/purchases/show.html.erb b/app/views/purchases/show.html.erb index d75fb18684..9969b9153c 100644 --- a/app/views/purchases/show.html.erb +++ b/app/views/purchases/show.html.erb @@ -30,17 +30,28 @@
+ + + + + + + - - - + + + +
Date of Purchase:Vendor:Storage Location:
Date of Purchase:Vendor:Storage Location:<%= @purchase.issued_at.to_fs(:distribution_date) %> (entered: <%= @purchase.created_at.to_fs(:distribution_date) %>)<%= @purchase.purchased_from_view %><%= @purchase.storage_view %>
+ + + + + - - - +
Comment:
<%= @purchase.issued_at.to_fs(:distribution_date) %> (entered: <%= @purchase.created_at.to_fs(:distribution_date) %>)<%= @purchase.purchased_from_view %><%= @purchase.storage_view %><%= @purchase.comment || '' %>
diff --git a/spec/requests/purchases_requests_spec.rb b/spec/requests/purchases_requests_spec.rb index abf7f1342a..d60b23f484 100644 --- a/spec/requests/purchases_requests_spec.rb +++ b/spec/requests/purchases_requests_spec.rb @@ -264,7 +264,21 @@ describe "GET #show" do let(:item) { create(:item) } - let!(:purchase) { create(:purchase, :with_items, item: item) } + let(:storage_location) { create(:storage_location, organization: organization, name: 'Some Storage') } + let(:vendor) { create(:vendor, organization: organization, business_name: 'Another Business') } + let(:purchase) { create(:purchase, :with_items, comment: 'Fine day for diapers, it is.', created_at: 1.month.ago, issued_at: 1.day.ago, item: item, storage_location: storage_location, vendor: vendor) } + + it "shows the purchase info" do + freeze_time do + date_of_purchase = "#{1.day.ago.to_fs(:distribution_date)} (entered: #{1.month.ago.to_fs(:distribution_date)})" + + get purchase_path(id: purchase.id) + expect(response.body).to include(date_of_purchase) + expect(response.body).to include('Another Business') + expect(response.body).to include('Some Storage') + expect(response.body).to include('Fine day for diapers, it is.') + end + end it "shows an enabled edit button" do get purchase_path(id: purchase.id)