Remove DateTime.parse usage

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.
This commit is contained in:
Javi Martín
2019-06-21 03:52:08 +02:00
parent a27ada662d
commit 71bad63226

View File

@@ -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) }