summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoshbabier <joshbabier@gmail.com>2016-08-03 20:42:18 -0400
committerjoshbabier <joshbabier@gmail.com>2016-08-04 14:50:39 -0400
commita92281cecb80b5d85ebac3f9801de02bd3b3a6a8 (patch)
tree4a59a2e75cc403ccd3e98b6b374af65a5a77a152
parentb5eb94ea0ca740bef801cc31870bc753d32924eb (diff)
downloadgitlab-ce-a92281cecb80b5d85ebac3f9801de02bd3b3a6a8.tar.gz
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
-rw-r--r--spec/factories/broadcast_messages.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/factories/broadcast_messages.rb b/spec/factories/broadcast_messages.rb
index efe9803b1a7..c2fdf89213a 100644
--- a/spec/factories/broadcast_messages.rb
+++ b/spec/factories/broadcast_messages.rb
@@ -1,8 +1,8 @@
FactoryGirl.define do
factory :broadcast_message do
message "MyText"
- starts_at Date.yesterday
- ends_at Date.tomorrow
+ starts_at 1.day.ago
+ ends_at 1.day.from_now
trait :expired do
starts_at 5.days.ago