mirror of
https://github.com/Evolix/chexpire.git
synced 2024-05-08 03:28:39 +02:00
factory_bot: static arguments become dynamic
This commit is contained in:
parent
c100839691
commit
6211745734
|
@ -27,9 +27,9 @@
|
|||
FactoryBot.define do
|
||||
factory :check_log do
|
||||
check
|
||||
status :pending
|
||||
exit_status nil
|
||||
parsed_response nil
|
||||
raw_response nil
|
||||
status { :pending }
|
||||
exit_status { nil }
|
||||
parsed_response { nil }
|
||||
raw_response { nil }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,20 +25,20 @@ FactoryBot.define do
|
|||
factory :check_notification do
|
||||
check
|
||||
notification
|
||||
status :pending
|
||||
sent_at nil
|
||||
status { :pending }
|
||||
sent_at { nil }
|
||||
|
||||
trait :ongoing do
|
||||
status :ongoing
|
||||
status { :ongoing }
|
||||
end
|
||||
|
||||
trait :succeed do
|
||||
status :succeed
|
||||
status { :succeed }
|
||||
sent_at { 1.day.ago }
|
||||
end
|
||||
|
||||
trait :failed do
|
||||
status :failed
|
||||
status { :failed }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,54 +34,54 @@
|
|||
FactoryBot.define do
|
||||
factory :check do
|
||||
user
|
||||
kind :domain
|
||||
domain "domain.fr"
|
||||
domain_created_at Time.new(2016, 4, 1, 12, 0, 0, "+02:00")
|
||||
domain_updated_at Time.new(2017, 3, 1, 12, 0, 0, "+02:00")
|
||||
domain_expires_at Time.new(2019, 4, 1, 12, 0, 0, "+02:00")
|
||||
active true
|
||||
vendor nil
|
||||
comment nil
|
||||
last_run_at nil
|
||||
last_success_at nil
|
||||
consecutive_failures 0
|
||||
mode :auto
|
||||
kind { :domain }
|
||||
domain { "domain.fr" }
|
||||
domain_created_at { Time.new(2016, 4, 1, 12, 0, 0, "+02:00") }
|
||||
domain_updated_at { Time.new(2017, 3, 1, 12, 0, 0, "+02:00") }
|
||||
domain_expires_at { Time.new(2019, 4, 1, 12, 0, 0, "+02:00") }
|
||||
active { true }
|
||||
vendor { nil }
|
||||
comment { nil }
|
||||
last_run_at { nil }
|
||||
last_success_at { nil }
|
||||
consecutive_failures { 0 }
|
||||
mode { :auto }
|
||||
|
||||
trait :domain do
|
||||
kind :domain
|
||||
kind { :domain }
|
||||
end
|
||||
|
||||
trait :ssl do
|
||||
kind :ssl
|
||||
kind { :ssl }
|
||||
end
|
||||
|
||||
trait :nil_dates do
|
||||
domain_created_at nil
|
||||
domain_updated_at nil
|
||||
domain_expires_at nil
|
||||
domain_created_at { nil }
|
||||
domain_updated_at { nil }
|
||||
domain_expires_at { nil }
|
||||
end
|
||||
|
||||
trait :expires_next_week do
|
||||
domain_expires_at 1.week.from_now
|
||||
domain_expires_at { 1.week.from_now }
|
||||
end
|
||||
|
||||
trait :expires_next_year do
|
||||
domain_expires_at 1.year.from_now
|
||||
domain_expires_at { 1.year.from_now }
|
||||
end
|
||||
|
||||
trait :last_runs_failed do
|
||||
consecutive_failures 5
|
||||
last_run_at 3.days.ago - 90.minutes
|
||||
last_success_at 7.days.ago - 2.hours
|
||||
consecutive_failures { 5 }
|
||||
last_run_at { 3.days.ago - 90.minutes }
|
||||
last_success_at { 7.days.ago - 2.hours }
|
||||
end
|
||||
|
||||
trait :last_run_succeed do
|
||||
last_run_at 25.hour.ago
|
||||
last_success_at 25.hour.ago
|
||||
last_run_at { 25.hours.ago }
|
||||
last_success_at { 25.hours.ago }
|
||||
end
|
||||
|
||||
trait :inactive do
|
||||
active false
|
||||
active { false }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,13 +29,13 @@
|
|||
FactoryBot.define do
|
||||
factory :notification do
|
||||
user
|
||||
interval 30
|
||||
channel :email
|
||||
interval { 30 }
|
||||
channel { :email }
|
||||
sequence(:label) { |n| "#{recipient}-#{n} (#{interval})" }
|
||||
recipient "recipient@domain.fr"
|
||||
recipient { "recipient@domain.fr" }
|
||||
|
||||
trait :email do
|
||||
channel :email
|
||||
channel { :email }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,14 +38,14 @@ require "securerandom"
|
|||
FactoryBot.define do
|
||||
factory :user do
|
||||
sequence(:email) { |n| "user-#{n}@chexpire.org" }
|
||||
password "password"
|
||||
confirmed_at Time.new(2018, 4, 1, 12, 0, 0, "+02:00")
|
||||
notifications_enabled true
|
||||
locale "en"
|
||||
tos_accepted true
|
||||
password { "password" }
|
||||
confirmed_at { Time.new(2018, 4, 1, 12, 0, 0, "+02:00") }
|
||||
notifications_enabled { true }
|
||||
locale { "en" }
|
||||
tos_accepted { true }
|
||||
|
||||
trait :fr do
|
||||
locale "fr"
|
||||
locale { "fr" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue