Improves some code format details

This commit is contained in:
decabeza
2018-10-30 18:48:53 +01:00
parent 54950d14c9
commit a218f8cced
5 changed files with 11 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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