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

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

new rspec

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