Sha256: f23a35dbbc51bdb44889c69f9a2c8791dace537df8e8c1297fa4eceedde9a030

Contents?: true

Size: 1.55 KB

Versions: 11

Compression:

Stored size: 1.55 KB

Contents

require File.dirname(__FILE__) + '/../../../../../spec_helper'
include OpenEHR::RM::DataTypes::Basic
include OpenEHR::RM::Support::Identification
include OpenEHR::RM::DataTypes::Text

describe DvState do
  before(:each) do
    @terminology_id = TerminologyID.new(:value => 'openher')
    code_phrase = CodePhrase.new(:code_string => '524',
                                 :terminology_id => @terminology_id)
    dv_coded_text = DvCodedText.new(:value => "initial",
                                    :defining_code => code_phrase)
    @dv_state = DvState.new(:value => dv_coded_text,
                            :is_terminal => false)
  end

  it 'should be an instance of DvState' do
    @dv_state.should be_an_instance_of DvState
  end

  it 's value should be initial' do
    @dv_state.value.value.should == 'initial'
  end

  it 'should change other value assigned' do
    code_phrase = CodePhrase.new(:code_string => '526',
                                 :terminology_id => @terminology_id)
    dv_coded_text = DvCodedText.new(:value =>'planned',
                                    :defining_code => code_phrase)
    lambda {
      @dv_state.value = dv_coded_text
    }.should change{@dv_state.value.value}.from('initial').to('planned')
  end

  it 'is not terminal' do
    @dv_state.is_terminal?.should be_false
  end

  it 'should not be terminal * another expression' do
    @dv_state.should_not be_terminal
  end

  it 'should change to terminal' do
    lambda {
      @dv_state.is_terminal = true
    }.should change(@dv_state, :is_terminal?).from(false).to(true)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
openehr-1.2.8 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.7 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.6 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.5 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.4 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.3 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.2 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.1 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.2.0 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.1.6 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb
openehr-1.1.5 spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb