Sha256: b4874ff71f2e20afc5ac32a6614b4079c9b2619159e539874273fceb42a906a8
Contents?: true
Size: 1.18 KB
Versions: 27
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true # encoding: utf-8 shared_context 'using AS time zone' do before do Mongoid.use_activesupport_time_zone = true Time.zone = "Tokyo" end after do Time.zone = nil end end shared_context 'not using AS time zone' do before do Mongoid.use_activesupport_time_zone = false Time.zone = 'Tokyo' end after do Mongoid.use_activesupport_time_zone = true Time.zone = nil end end shared_examples_for 'mongoizes to AS::TimeWithZone' do it 'is an AS::TimeWithZone' do expect(mongoized.class).to eq(ActiveSupport::TimeWithZone) end it 'is equal to expected time' do expect(expected_time).to be_a(ActiveSupport::TimeWithZone) expect(mongoized).to eq(expected_time) end end shared_examples_for 'mongoizes to Time' do it 'is a Time' do expect(mongoized.class).to eq(Time) end it 'is equal to expected time' do expect(expected_time).to be_a(Time) expect(mongoized).to eq(expected_time) end end shared_examples_for 'maintains precision when mongoized' do it 'maintains precision' do # 123457 happens to be consistently obtained by various tests expect(mongoized.to_f.to_s).to match(/\.123457/) end end
Version data entries
27 entries across 27 versions & 2 rubygems