Skip to content

Commit

Permalink
Remove DateTime.parse usage
Browse files Browse the repository at this point in the history
While the correct usage would require an `in_time_zone` call, the code
can be simplified and the relationship between the current date and the
last `proposal.created_at + index.days` is now a bit easier to notice.

We use the beginning of the month as the date of the first action
because we expect all 8 actions to be created on the same month.
  • Loading branch information
javierm committed Jun 30, 2019
1 parent 0bfcdb2 commit 3dcf25b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions spec/requests/dashboard/achievements_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
require "rails_helper"

describe Dashboard::AchievementsController do
let(:created_at) { DateTime.parse("2018-01-01 12:00:00") }
let(:proposal) { create(:proposal, created_at: created_at) }
let(:proposal) { create(:proposal, created_at: 7.days.ago.beginning_of_month) }
let(:executed_actions) { create_list(:dashboard_action, 8, :active, :proposed_action) }
let!(:non_executed_actions) { create_list(:dashboard_action, 8, :active, :proposed_action) }

Expand Down

0 comments on commit 3dcf25b

Please sign in to comment.