Sha256: af555e1807664b2a0d16bf1d10d8330231e3a6de9d606ca2e128853c4284353b
Contents?: true
Size: 947 Bytes
Versions: 1
Compression:
Stored size: 947 Bytes
Contents
require_relative 'spec_helper' describe 'Mongoid::TimeRange integration' do before { Timecop.freeze } describe 'create document without any attributes' do subject { Document.create } it 'sets from to current time and to to nil' do subject.range.to_h.must_equal from: Time.now, to: nil end end describe 'create document only with from attribute' do subject { Document.create(range: { from: Time.now.beginning_of_year }) } it 'sets from to given time and to to nil' do subject.range.to_h.must_equal from: Time.now.beginning_of_year, to: nil end end describe 'create document with both attributes' do subject { Document.create(range: { from: Time.now.beginning_of_year, to: Time.now.end_of_year }) } it 'sets from and to to given time' do subject.range.to_h.must_equal from: Time.now.beginning_of_year, to: Time.now.end_of_year end end after { Timecop.return } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-time_range-0.2.0 | spec/integration_spec.rb |