From 47a055ea481ce3f0523db30a2a941f24530b3601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Salvador=20P=C3=A9rez=20Garc=C3=ADa?= Date: Fri, 22 Jun 2018 15:32:40 +0200 Subject: [PATCH] Use time.current instead of Time.now Use time.current instead of Time.now in order to avoid flakies. --- app/views/proposals/_preview.html.erb | 2 +- spec/factories.rb | 10 +++++----- spec/models/proposal_executed_dashboard_action_spec.rb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/proposals/_preview.html.erb b/app/views/proposals/_preview.html.erb index 0152b4a20..b1b0c45e1 100644 --- a/app/views/proposals/_preview.html.erb +++ b/app/views/proposals/_preview.html.erb @@ -12,7 +12,7 @@ <%= render "shared/canonical", href: proposal_url(@proposal) %> <% end %> -<% cache_if !preview, [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %> +<% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %>
diff --git a/spec/factories.rb b/spec/factories.rb index 2bd9e958c..9ffb97b35 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -170,7 +170,7 @@ FactoryBot.define do responsible_name 'John Snow' terms_of_service '1' skip_map '1' - published_at { Time.now } + published_at { Time.current } association :author, factory: :user trait :hidden do @@ -1060,7 +1060,7 @@ LOREM_IPSUM end trait :deleted do - hidden_at { Time.now.utc } + hidden_at { Time.current } end trait :proposed_action do @@ -1075,7 +1075,7 @@ LOREM_IPSUM factory :proposal_executed_dashboard_action, class: 'ProposalExecutedDashboardAction' do proposal proposal_dashboard_action - executed_at { Time.now } + executed_at { Time.current } trait :with_comments do comments { Faker::Lorem.sentence(10) } @@ -1085,7 +1085,7 @@ LOREM_IPSUM factory :administrator_task do source { |s| s.association(:proposal_executed_dashboard_action, :with_comments) } user - executed_at { Time.now } + executed_at { Time.current } trait :pending do user { nil } @@ -1094,7 +1094,7 @@ LOREM_IPSUM trait :done do user - executed_at { Time.now } + executed_at { Time.current } end end end diff --git a/spec/models/proposal_executed_dashboard_action_spec.rb b/spec/models/proposal_executed_dashboard_action_spec.rb index d03a2545d..12f4ac17e 100644 --- a/spec/models/proposal_executed_dashboard_action_spec.rb +++ b/spec/models/proposal_executed_dashboard_action_spec.rb @@ -14,7 +14,7 @@ describe ProposalExecutedDashboardAction do create :proposal_dashboard_action, request_to_administrators: request_to_administrators, link: Faker::Internet.url end let(:request_to_administrators) { false } - let(:executed_at) { Time.now } + let(:executed_at) { Time.current } let(:comments) { '' } it { is_expected.to be_valid }