From a218f8ccedcfcb29f9661fa8f2f1207f5218edc3 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 30 Oct 2018 18:48:53 +0100 Subject: [PATCH] Improves some code format details --- app/controllers/notifications_controller.rb | 1 + db/dev_seeds/banners.rb | 10 +++++----- spec/factories/legislations.rb | 5 +++-- spec/factories/proposals.rb | 2 +- spec/factories/verifications.rb | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 2c4fd3e9f..e2293f2c3 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -36,6 +36,7 @@ class NotificationsController < ApplicationController end private + def linkable_resource_path(notification) if notification.linkable_resource.is_a?(AdminNotification) notification.linkable_resource.link || notifications_path diff --git a/db/dev_seeds/banners.rb b/db/dev_seeds/banners.rb index 1717615a2..641f51994 100644 --- a/db/dev_seeds/banners.rb +++ b/db/dev_seeds/banners.rb @@ -4,11 +4,11 @@ section "Creating banners" do description = Faker::Lorem.sentence(word_count = 12) target_url = Rails.application.routes.url_helpers.proposal_path(proposal) 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)) + 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)) I18n.available_locales.map do |locale| Globalize.with_locale(locale) do banner.description = "Description for locale #{locale}" diff --git a/spec/factories/legislations.rb b/spec/factories/legislations.rb index 913ab33e8..bacfa19a3 100644 --- a/spec/factories/legislations.rb +++ b/spec/factories/legislations.rb @@ -16,6 +16,7 @@ FactoryBot.define do title "A collaborative legislation process" description "Description of the process" summary "Summary of the process" + start_date { Date.current - 5.days } end_date { Date.current + 5.days } debate_start_date { Date.current - 5.days } @@ -87,8 +88,8 @@ FactoryBot.define do end trait :open do - start_date 1.week.ago - end_date 1.week.from_now + start_date { 1.week.ago } + end_date { 1.week.from_now } end end diff --git a/spec/factories/proposals.rb b/spec/factories/proposals.rb index 358411d79..d65d5afb3 100644 --- a/spec/factories/proposals.rb +++ b/spec/factories/proposals.rb @@ -30,7 +30,7 @@ FactoryBot.define do end trait :archived do - created_at 25.months.ago + created_at { 25.months.ago } end trait :with_hot_score do diff --git a/spec/factories/verifications.rb b/spec/factories/verifications.rb index 957aaab0e..e81e21ed5 100644 --- a/spec/factories/verifications.rb +++ b/spec/factories/verifications.rb @@ -12,7 +12,7 @@ FactoryBot.define do user document_number document_type "1" - date_of_birth Time.zone.local(1980, 12, 31).to_date + date_of_birth { Time.zone.local(1980, 12, 31).to_date } postal_code "28013" terms_of_service '1'