Use time.current instead of Time.now

Use time.current instead of Time.now in order to avoid flakies.
This commit is contained in:
Juan Salvador Pérez García
2018-06-22 15:32:40 +02:00
parent e90f5f1ba4
commit 47a055ea48
3 changed files with 7 additions and 7 deletions

View File

@@ -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 %>
<div class="proposal-show">
<div id="<%= dom_id(@proposal) %>" class="row">
<div class="small-12 medium-9 column">

View File

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

View File

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