gitlab-org--gitlab-foss/spec/factories/broadcast_messages.rb
joshbabier a92281cecb TST: Use more accurate time windows so tests do not fail
Currently, the way the 'starts_at' and 'ends_at' attributes are set,
if the specs are run at one second to midnight, the broadcast message
will expire in one second. I have changed it so that we are guaranteed
a period of one day until expiration. I believe this is the desired
behaviour and it's also consistent with the rest of the factory.

This corrects the following three specs that can fail depending upon
where and when they are run:

./spec/helpers/broadcast_messages_helper_spec.rb:42
./spec/models/broadcast_message_spec.rb:26
./spec/models/broadcast_message_spec.rb:47
2016-08-04 14:50:39 -04:00

17 lines
311 B
Ruby

FactoryGirl.define do
factory :broadcast_message do
message "MyText"
starts_at 1.day.ago
ends_at 1.day.from_now
trait :expired do
starts_at 5.days.ago
ends_at 3.days.ago
end
trait :future do
starts_at 5.days.from_now
ends_at 6.days.from_now
end
end
end