diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a1c4b58a8..2b5458e96 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -96,13 +96,11 @@ RSpec.configure do |config| end config.before(:each, :with_different_time_zone) do - system_zone = ActiveSupport::TimeZone.new("UTC") - local_zone = ActiveSupport::TimeZone.new("Madrid") + application_zone = ActiveSupport::TimeZone.new("UTC") + system_zone = ActiveSupport::TimeZone.new("Madrid") - # Make sure the date defined by `config.time_zone` and - # the local date are different. - allow(Time).to receive(:zone).and_return(system_zone) - allow(Time).to receive(:now).and_return(Date.current.at_end_of_day.in_time_zone(local_zone)) + allow(Time).to receive(:zone).and_return(application_zone) + allow(Time).to receive(:now).and_return(Date.current.end_of_day.in_time_zone(system_zone)) allow(Date).to receive(:today).and_return(Time.now.to_date) end