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

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

CodePhrase modified

File size: 1.4 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(:code_string => '524',
10 :terminology_id => @terminology_id)
11 dv_coded_text = DvCodedText.new(:value => "initial",
12 :defining_code => code_phrase)
13 @dv_state = DvState.new(:value => dv_coded_text,
14 :is_terminal => false)
15 end
16
17 it 'should be an instance of DvState' do
18 @dv_state.should be_an_instance_of DvState
19 end
20
21 it 's value should be initial' do
22 @dv_state.value.value.should == 'initial'
23 end
24
25 it 'should change other value assigned' do
26 code_phrase = CodePhrase.new(:code_string => '526',
27 :terminology_id => @terminology_id)
28 dv_coded_text = DvCodedText.new(:value =>'planned',
29 :defining_code => code_phrase)
30 lambda {
31 @dv_state.value = dv_coded_text
32 }.should change{@dv_state.value.value}.from('initial').to('planned')
33 end
34
35 it 'is not terminal' do
36 @dv_state.is_terminal?.should be_false
37 end
38
39 it 'should change to terminal' do
40 lambda {
41 @dv_state.is_terminal = true
42 }.should change(@dv_state, :is_terminal?).from(false).to(true)
43 end
44end
Note: See TracBrowser for help on using the repository browser.