Add and apply Rails/DurationArithmetic rubocop rule

This rule was added in rubocop-rails 2.13.0. We were already applying it
most of the time.
This commit is contained in:
Javi Martín
2022-08-24 22:32:43 +02:00
parent 68899c80b6
commit c8270d58bd
18 changed files with 42 additions and 39 deletions

View File

@@ -6,9 +6,9 @@ section "Creating banners" do
banner = Banner.new(title: title,
description: description,
target_url: target_url,
post_started_at: rand((Time.current - 1.week)..(Time.current - 1.day)),
post_ended_at: rand((Time.current - 1.day)..(Time.current + 1.week)),
created_at: rand((Time.current - 1.week)..Time.current))
post_started_at: rand((1.week.ago)..(1.day.ago)),
post_ended_at: rand((1.day.ago)..(1.week.from_now)),
created_at: rand((1.week.ago)..Time.current))
I18n.available_locales.map do |locale|
Globalize.with_locale(locale) do
banner.description = "Description for locale #{locale}"

View File

@@ -113,7 +113,7 @@ section "Creating Investments" do
heading: heading,
group: heading.group,
budget: heading.group.budget,
created_at: rand((Time.current - 1.week)..Time.current),
created_at: rand((1.week.ago)..Time.current),
feasibility: %w[undecided unfeasible feasible feasible feasible feasible].sample,
unfeasibility_explanation: Faker::Lorem.paragraph,
valuation_finished: [false, true].sample,
@@ -160,7 +160,7 @@ section "Winner Investments" do
budget: heading.group.budget,
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
description: "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>",
created_at: rand((Time.current - 1.week)..Time.current),
created_at: rand((1.week.ago)..Time.current),
feasibility: "feasible",
valuation_finished: true,
selected: true,

View File

@@ -5,7 +5,7 @@ section "Creating Debates" do
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
debate = Debate.create!(author: author,
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
created_at: rand((Time.current - 1.week)..Time.current),
created_at: rand((1.week.ago)..Time.current),
description: description,
tag_list: tags.sample(3).join(","),
geozone: Geozone.all.sample,
@@ -26,7 +26,7 @@ section "Creating Debates" do
debate = Debate.create!(author: author,
title: Faker::Lorem.sentence(word_count: 3).truncate(60),
created_at: rand((Time.current - 1.week)..Time.current),
created_at: rand((1.week.ago)..Time.current),
description: description,
tag_list: tags.sample(3).join(","),
geozone: Geozone.all.sample,

View File

@@ -34,7 +34,7 @@ section "Creating Proposals" do
summary: summary,
responsible_name: Faker::Name.name,
description: description,
created_at: rand((Time.current - 1.week)..Time.current),
created_at: rand((1.week.ago)..Time.current),
tag_list: tags.sample(3).join(","),
geozone: Geozone.all.sample,
terms_of_service: "1",
@@ -89,7 +89,7 @@ section "Creating Successful Proposals" do
summary: Faker::Lorem.sentence(word_count: 3),
responsible_name: Faker::Name.name,
description: description,
created_at: rand((Time.current - 1.week)..Time.current),
created_at: rand((1.week.ago)..Time.current),
tag_list: tags.sample(3).join(","),
geozone: Geozone.all.sample,
terms_of_service: "1",
@@ -115,7 +115,7 @@ section "Creating Successful Proposals" do
summary: Faker::Lorem.sentence(word_count: 3),
responsible_name: Faker::Name.name,
description: description,
created_at: rand((Time.current - 1.week)..Time.current),
created_at: rand((1.week.ago)..Time.current),
tag_list: tags.sample(3).join(","),
geozone: Geozone.all.sample,
terms_of_service: "1",

View File

@@ -9,7 +9,7 @@ section "Creating Users" do
confirmed_at: Time.current,
terms_of_service: "1",
gender: %w[male female].sample,
date_of_birth: rand((Time.current - 80.years)..(Time.current - 16.years)),
date_of_birth: rand((80.years.ago)..(16.years.ago)),
public_activity: (rand(1..100) > 30)
)
end