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
open_ehr-0.9.4 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-0.9.3 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-0.9.2 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-0.9.1 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-0.9.0 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb
open_ehr-0.6.1 spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb