|
50 | 50 |
|
51 | 51 | context "when using the ActiveSupport time zone" do
|
52 | 52 | config_override :use_activesupport_time_zone, true
|
53 |
| - |
54 |
| - before do |
55 |
| - Time.zone = "Stockholm" |
56 |
| - end |
57 |
| - |
58 |
| - after do |
59 |
| - Time.zone = nil |
60 |
| - end |
| 53 | + time_zone_override "Stockholm" |
61 | 54 |
|
62 | 55 | it "returns an ActiveSupport::TimeWithZone" do
|
63 | 56 | expect(ActiveSupport::TimeWithZone.demongoize(time).class).to eq(ActiveSupport::TimeWithZone)
|
|
113 | 106 |
|
114 | 107 | context "when using the ActiveSupport time zone" do
|
115 | 108 | config_override :use_activesupport_time_zone, true
|
| 109 | + time_zone_override "Stockholm" |
116 | 110 |
|
117 | 111 | let(:time) do
|
118 | 112 | Time.utc(2010, 11, 19, 0, 30)
|
119 | 113 | end
|
120 | 114 |
|
121 |
| - before do |
122 |
| - Time.zone = "Stockholm" |
123 |
| - end |
124 |
| - |
125 |
| - after do |
126 |
| - Time.zone = nil |
127 |
| - end |
128 |
| - |
129 | 115 | it "returns utc" do
|
130 | 116 | expect(ActiveSupport::TimeWithZone.demongoize(time)).to eq(
|
131 | 117 | ActiveSupport::TimeZone['UTC'].local(2010, 11, 19, 0, 30)
|
|
203 | 189 |
|
204 | 190 | context "when using the ActiveSupport time zone" do
|
205 | 191 | config_override :use_activesupport_time_zone, true
|
206 |
| - |
207 |
| - before do |
208 |
| - # if this is actually your time zone, the following tests are useless |
209 |
| - Time.zone = "Stockholm" |
210 |
| - end |
211 |
| - |
212 |
| - after do |
213 |
| - Time.zone = nil |
214 |
| - end |
| 192 | + # if this is actually your time zone, the following tests are useless |
| 193 | + time_zone_override "Stockholm" |
215 | 194 |
|
216 | 195 | context "when the local time is not observing daylight saving" do
|
217 | 196 |
|
|
247 | 226 |
|
248 | 227 | context "when using the ActiveSupport time zone" do
|
249 | 228 | config_override :use_activesupport_time_zone, true
|
| 229 | + time_zone_override "Stockholm" |
250 | 230 |
|
251 | 231 | let(:datetime) do
|
252 | 232 | DateTime.new(2010, 11, 19)
|
253 | 233 | end
|
254 | 234 |
|
255 |
| - before do |
256 |
| - # if this is actually your time zone, the following tests are useless |
257 |
| - Time.zone = "Stockholm" |
258 |
| - end |
259 |
| - |
260 |
| - after do |
261 |
| - Time.zone = nil |
262 |
| - end |
263 |
| - |
264 | 235 | it "assumes the given time is local" do
|
265 | 236 | expect(ActiveSupport::TimeWithZone.mongoize(datetime)).to eq(
|
266 | 237 | Time.utc(2010, 11, 19)
|
|
317 | 288 |
|
318 | 289 | context "when using the ActiveSupport time zone" do
|
319 | 290 | config_override :use_activesupport_time_zone, true
|
| 291 | + time_zone_override "Stockholm" |
320 | 292 |
|
321 | 293 | let(:date) do
|
322 | 294 | Date.new(2010, 11, 19)
|
323 | 295 | end
|
324 | 296 |
|
325 |
| - before do |
326 |
| - # if this is actually your time zone, the following tests are useless |
327 |
| - Time.zone = "Stockholm" |
328 |
| - end |
329 |
| - |
330 |
| - after do |
331 |
| - Time.zone = nil |
332 |
| - end |
333 |
| - |
334 | 297 | it "assumes the given time is local" do
|
335 | 298 | expect(ActiveSupport::TimeWithZone.mongoize(date)).to eq(Time.utc(2010, 11, 18, 23))
|
336 | 299 | end
|
|
349 | 312 |
|
350 | 313 | context "when using the ActiveSupport time zone" do
|
351 | 314 | config_override :use_activesupport_time_zone, true
|
352 |
| - |
353 |
| - before do |
354 |
| - # if this is actually your time zone, the following tests are useless |
355 |
| - Time.zone = "Stockholm" |
356 |
| - end |
357 |
| - |
358 |
| - after do |
359 |
| - Time.zone = nil |
360 |
| - end |
| 315 | + time_zone_override "Stockholm" |
361 | 316 |
|
362 | 317 | it "assumes the given time is local" do
|
363 | 318 | expect(ActiveSupport::TimeWithZone.mongoize(array)).to eq(
|
|
0 commit comments