Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/reports/_distribution.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<% end %>
</div>
<div class="pull-right">
<%= distance_of_time_in_words_to_now distribution.created_at %> ago
<%= distance_of_time_in_words_to_now distribution.issued_at %> ago
</div>
2 changes: 1 addition & 1 deletion app/views/reports/_donation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<% end %>
</div>
<div class="pull-right">
<%= distance_of_time_in_words_to_now donation.created_at %> ago
<%= distance_of_time_in_words_to_now donation.issued_at %> ago
</div>
2 changes: 1 addition & 1 deletion app/views/reports/_purchase.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<% end %>
</div>
<div class="pull-right">
<%= distance_of_time_in_words_to_now purchase.created_at %> ago
<%= distance_of_time_in_words_to_now purchase.issued_at %> ago
</div>
12 changes: 12 additions & 0 deletions spec/requests/reports/distributions_summary_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
sign_in(user)
end

describe "time display" do
let!(:distribution) { create(:distribution, :with_items, issued_at: 2.days.ago) }

before do
get reports_distributions_summary_path
end

it "uses issued_at for the relative time display, not created_at" do
expect(response.body).to include("2 days ago")
end
end

context "the index page" do
context "without filters" do
before do
Expand Down
12 changes: 12 additions & 0 deletions spec/requests/reports/donations_summary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
sign_in user
end

describe "time display" do
let!(:donation) { create(:donation, :with_items, issued_at: 1.day.ago) }

before do
get reports_donations_summary_path
end

it "uses issued_at for the relative time display, not created_at" do
expect(response.body).to include("1 day ago")
end
end

describe "GET #index" do
subject do
get reports_donations_summary_path(format: response_format)
Expand Down
12 changes: 12 additions & 0 deletions spec/requests/reports/purchases_summary_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
sign_in(user)
end

describe "time display" do
let!(:purchase) { create(:purchase, :with_items, issued_at: 3.days.ago) }

before do
get reports_purchases_summary_path
end

it "uses issued_at for the relative time display, not created_at" do
expect(response.body).to include("3 days ago")
end
end

describe "GET #index" do
it "shows a list of recent purchases" do
get reports_purchases_summary_path
Expand Down
1 change: 1 addition & 0 deletions spec/system/donation_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
let(:organization_admin) { create(:organization_admin, organization: organization) }

context "When signed in as a normal user" do

before do
sign_in user
end
Expand Down
Loading