Sha256: 23e7915b4fe0d7d2596b5d24927834610afd9442cebaad3f6c0ad72faeba3b37

Contents?: true

Size: 849 Bytes

Versions: 2

Compression:

Stored size: 849 Bytes

Contents

require File.dirname(__FILE__) + '/../../../../../../spec_helper'
require 'open_ehr/rm/data_types/quantity/date_time'
include OpenEHR::RM::DataTypes::Quantity::DateTime

describe DvDateTime do
  before(:each) do
    @dv_date_time = DvDateTime.new(:value => '2009-09-29T15:03:22.3')
  end

  it 'should be an instance of DvDateTime' do
    @dv_date_time.should be_an_instance_of DvDateTime
  end

  it 'magnitude should be 63425495002.3' do
    @dv_date_time.magnitude.should be_within(0.01).of(63423697018.3)
  end

  it 'should be equal when magnitude is same' do
    @dv_date_time.should == DvDateTime.new(:value => '2009-09-29T15:03:22.3')
  end

  it 'diff should be caluculated from past to future' do
    future = DvDateTime.new(:value => '2009-10-29T16:23:30.3')
    @dv_date_time.diff(future).value.should == 'P0Y1M0W0DT1H20M8.0S'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
open_ehr-1.0.1 spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb