From 3e70e6d0afcbaa448581055846dabe838852136e Mon Sep 17 00:00:00 2001 From: Sebastian Fiedlschuster Date: Mon, 29 Sep 2014 21:58:05 +0200 Subject: [PATCH] giving another healing potion to randomly failing specs using Timecop. --- spec/spec_helper.rb | 5 +++++ .../validity_range_for_indirect_memberships_spec.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5987d8f70..ba0b28032 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -236,6 +236,11 @@ # Clear the cache. Rails.cache.clear + + # Freeze the time. Whenever time progression is needed during a spec, + # it should be done using the `time_travel` support method: `time_travel 2.seconds`. + # + Timecop.freeze # create the basic objects that are needed for all specs Group.find_or_create_everyone_group diff --git a/vendor/engines/your_platform/spec/models/user_group_membership_mixins/validity_range_for_indirect_memberships_spec.rb b/vendor/engines/your_platform/spec/models/user_group_membership_mixins/validity_range_for_indirect_memberships_spec.rb index 4cd6ecb68..6727d2f0e 100644 --- a/vendor/engines/your_platform/spec/models/user_group_membership_mixins/validity_range_for_indirect_memberships_spec.rb +++ b/vendor/engines/your_platform/spec/models/user_group_membership_mixins/validity_range_for_indirect_memberships_spec.rb @@ -231,7 +231,7 @@ # ==================================================================================================== describe "#valid_at?(time)" do - subject { @indirect_membership.valid_at? @time_to_check } + subject { @indirect_membership.reload.valid_at? @time_to_check } specify "preliminaries" do @indirect_membership.earliest_direct_membership.valid_from.to_i.should == @t1.to_i @indirect_membership.earliest_direct_membership.valid_to.to_i.should == @t2.to_i