source: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb@ 220

Last change on this file since 220 was 220, checked in by KOBAYASHI, Shinji, 15 years ago

DvText modified

File size: 1.3 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::DataTypes::Basic
3include OpenEHR::RM::Support::Identification
4include OpenEHR::RM::DataTypes::Text
5
6describe DvState do
7 before(:each) do
8 @terminology_id = TerminologyId.new('openher')
9 code_phrase = CodePhrase.new('524', @terminology_id)
10 dv_coded_text = DvCodedText.new(:value => "initial",
11 :defining_code => code_phrase)
12 @dv_state = DvState.new(:value => dv_coded_text,
13 :is_terminal => false)
14 end
15
16 it 'should be an instance of DvState' do
17 @dv_state.should be_an_instance_of DvState
18 end
19
20 it 's value should be initial' do
21 @dv_state.value.value.should == 'initial'
22 end
23
24 it 'should change other value assigned' do
25 code_phrase = CodePhrase.new('526',@terminology_id)
26 dv_coded_text = DvCodedText.new(:value =>'planned',
27 :defining_code => code_phrase)
28 lambda {
29 @dv_state.value = dv_coded_text
30 }.should change{@dv_state.value.value}.from('initial').to('planned')
31 end
32
33 it 'is not terminal' do
34 @dv_state.is_terminal?.should be_false
35 end
36
37 it 'should change to terminal' do
38 lambda {
39 @dv_state.is_terminal = true
40 }.should change(@dv_state, :is_terminal?).from(false).to(true)
41 end
42end
Note: See TracBrowser for help on using the repository browser.