Sha256: 3ad61b3af1ba8986c8fe30d3fa4464f76db283c95230f7d307daf2296d453dd0

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 KB

Contents

# ticket 203
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
require 'openehr/am/openehr_profile/data_types/quantity'
include OpenEHR::AssumedLibraryTypes
include OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity

describe CQuantityItem do
  before(:each) do
    magnitude = Interval.new(:upper => 100, :lower => 0)
    precision = Interval.new(:upper => 10, :lower => 2)
    @c_quantity_item = CQuantityItem.new(:units => 'mg',
                                         :magnitude => magnitude,
                                         :precision => precision)
  end

  it 'is an instance of CQuantityItem' do
    @c_quantity_item.should be_an_instance_of CQuantityItem
  end

  it 'magnitude upper is 100' do
    @c_quantity_item.magnitude.upper.should be 100
  end

  it 'precision lower is -2' do
    @c_quantity_item.precision.lower.should be 2
  end

  it 'units is not nil' do
    expect {@c_quantity_item.units = nil}.to raise_error
  end

  it 'units is not be empty' do
    expect {@c_quantity_item.units = ''}.to raise_error
  end

  it 'is not precision unconstrained' do
    @c_quantity_item.should_not be_precision_unconstrained
  end
  context 'precision unconstrained' do
    before(:each) do
      @c_quantity_item.precision = Interval.new(:upper => -1, :lower => -1)
    end

    it 'precision unconstrained is true' do
      @c_quantity_item.should be_precision_unconstrained
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
openehr-1.2.8 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.7 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.6 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.5 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.4 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.3 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.2 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.1 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.2.0 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.1.6 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.1.5 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb