Sha256: 4f4a6f76eaf4f613045ea230830f232a98da3f265f7841524784deb06926dd04

Contents?: true

Size: 1.64 KB

Versions: 26

Compression:

Stored size: 1.64 KB

Contents

$:.unshift(File.dirname(__FILE__)) unless
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
#require File.dirname(__FILE__) + '/shared_examples_spec'
include OpenEHR::RM::DataStructures::History
include OpenEHR::RM::Composition::Content::Entry
include OpenEHR::RM::DataTypes::Text

describe Observation do
#  it_should_behave_like 'entry'
  let(:name) {DvText.new(:value => 'entry package')}
  let(:language) { double('language',:code_string => 'ja')}
  let(:encoding) { double('encoding', :code_string => 'UTF-8')}
  let(:subject) { double('PartyProxy')}

  before(:each) do
    data = stub(History, :archetype_node_id => 'at0002')
    state = stub(History, :archetype_node_id => 'at0003')
    @observation = Observation.new(:archetype_node_id => 'at0001',
                                   :name => name,
                                   :language => language,
                                   :encoding => encoding,
                                   :subject => subject,
                                   :data => data,
                                   :state => state)
  end

  it 'should be an instance of Observation' do
    @observation.should be_an_instance_of Observation
  end

  it 'data should be assigned properly' do
    @observation.data.archetype_node_id.should == 'at0002'
  end

  it 'should raise ArgumentError when nil assigned to data' do
    lambda {
      @observation.data = nil
    }.should raise_error ArgumentError
  end

  it 'state should be assigned properly' do
    @observation.state.archetype_node_id.should == 'at0003'
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
open_ehr-0.9.4 spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb
open_ehr-0.9.3 spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb
open_ehr-0.9.2 spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb
open_ehr-0.9.1 spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb
open_ehr-0.9.0 spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb
open_ehr-0.6.1 spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb