Sha256: a02013a705e05f3c454c224edd5629930988ad14692b690dc19e71d4e7ce31c2

Contents?: true

Size: 1.25 KB

Versions: 26

Compression:

Stored size: 1.25 KB

Contents

require File.dirname(__FILE__) + '/../../../../../spec_helper'
include OpenEHR::RM::DataTypes::Quantity

describe ReferenceRange do
  before(:each) do
    dv_interval ||= stub(DvInterval)
    @mock_dv_interval ||= mock('dv_interval')
    @reference_range = ReferenceRange.new(:meaning => 'test',
                                          :range => dv_interval)
  end

  it 'should be an instance of DvInterval' do
    @reference_range.should be_an_instance_of ReferenceRange
  end

  it 's meaning should be test' do
    @reference_range.meaning.should == 'test'
  end

  it 'should be in range' do
    @mock_dv_interval.should_receive(:has?).with(1).and_return(true)
    @reference_range.range = @mock_dv_interval
    @reference_range.is_in_range?(1).should be_true
  end

  it 'should be out of range' do
    @mock_dv_interval.should_receive(:has?).with(-1).and_return(false)
    @reference_range.range = @mock_dv_interval
    @reference_range.is_in_range?(-1).should be_false
  end

  it 'should raise ArgumentError with nil meaning' do
    lambda {
      @reference_range.meaning = nil
    }.should raise_error ArgumentError
  end

  it 'should raise ArgumentError with nil range' do
    lambda {
      @reference_range.range = nil
    }.should raise_error ArgumentError
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
openehr-1.2.8 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.7 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.6 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.5 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.4 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.3 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.2 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.1 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.2.0 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.1.6 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.1.5 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.1.4 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.1.3 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.1.2 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.1.1 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
openehr-1.1.0 spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-1.0.2 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-0.9.5 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb