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