Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/bundler/flipper-active_record-1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dorner authored Dec 10, 2024
2 parents b32b317 + 56cb8cb commit c8d899c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec.describe DistributionByCountyReportService, type: :service do
let(:year) { Time.current.year }
let(:issued_at_last_year) { Time.current.utc.change(year: year - 1).to_datetime }
let(:issued_at_last_year) { Time.current.change(year: year - 1).to_datetime }
let(:distributions) { [] }

include_examples "distribution_by_county"
Expand Down
2 changes: 1 addition & 1 deletion spec/support/distribution_by_county_shared_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
let(:organization_admin) { create(:organization_admin, organization: organization) }

let(:item_1) { create(:item, value_in_cents: 1050, organization: organization) }
let(:issued_at_present) { Time.current.utc.to_datetime }
let(:issued_at_present) { Time.current.to_datetime }
let(:partner_1) {
p1 = create(:partner, organization: organization)
p1.profile.served_areas << create_list(:partners_served_area, 4, partner_profile: p1.profile, client_share: 25)
Expand Down
10 changes: 5 additions & 5 deletions spec/system/distributions_by_county_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include_examples "distribution_by_county"

let(:current_year) { Time.current.year }
let(:issued_at_last_year) { Time.current.utc.change(year: current_year - 1).to_datetime }
let(:issued_at_last_year) { Time.current.change(year: current_year - 1).to_datetime }

before do
sign_in(user)
Expand Down Expand Up @@ -39,15 +39,15 @@

it("works for prior year") do
# Should NOT return distribution issued before previous calendar year
last_day_of_two_years_ago = Time.current.utc.change(year: current_year - 2, month: 12, day: 31).to_datetime
last_day_of_two_years_ago = Time.current.beginning_of_day.change(year: current_year - 2, month: 12, day: 31).to_datetime
create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: last_day_of_two_years_ago)

# Should return distribution issued during previous calendar year
one_year_ago = issued_at_last_year
create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: one_year_ago)

# Should NOT return distribution issued after previous calendar year
first_day_of_current_year = Time.current.utc.change(year: current_year, month: 1, day: 1).to_datetime
first_day_of_current_year = Time.current.end_of_day.change(year: current_year, month: 1, day: 1).to_datetime
create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: first_day_of_current_year)

visit_distribution_by_county_with_specified_date_range("Prior Year")
Expand All @@ -61,15 +61,15 @@

it("works for last 12 months") do
# Should NOT return disitribution issued before 12 months ago
one_year_and_one_day_ago = 1.year.ago.prev_day.to_datetime
one_year_and_one_day_ago = 1.year.ago.prev_day.beginning_of_day.to_datetime
create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: one_year_and_one_day_ago)

# Should return distribution issued during previous 12 months
today = issued_at_present
create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: today)

# Should NOT return distribution issued in the future
tomorrow = 1.day.from_now.to_datetime
tomorrow = 1.day.from_now.end_of_day.to_datetime
create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: tomorrow)

visit_distribution_by_county_with_specified_date_range("Last 12 Months")
Expand Down

0 comments on commit c8d899c

Please sign in to comment.