Sha256: d8b95f9928dbaebc61ce0c5ad409f4860f1a46d69fbd1d39b4b894c9e46ecfc6

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

# ticket 203
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

6 entries across 6 versions & 2 rubygems

Version Path
openehr-1.1.2 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.1.1 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
openehr-1.1.0 spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
open_ehr-1.0.2 spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb