From 71bad63226488009641355eef41dc833cc7faee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 21 Jun 2019 03:52:08 +0200 Subject: [PATCH] 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. --- spec/requests/dashboard/achievements_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/requests/dashboard/achievements_spec.rb b/spec/requests/dashboard/achievements_spec.rb index fd14f2974..325105244 100644 --- a/spec/requests/dashboard/achievements_spec.rb +++ b/spec/requests/dashboard/achievements_spec.rb @@ -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) }